generated from hantim/static-site-template
38 lines
992 B
YAML
38 lines
992 B
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Registry
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.CI_REGISTRY_TOKEN }}
|
|
run: echo "$REGISTRY_TOKEN" | docker login git.timothykim.net -u timothykim --password-stdin
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.timothykim.net/hantim/hcsuzuki.net:latest
|
|
|
|
- name: Deploy
|
|
env:
|
|
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
|
|
chmod 600 ~/.ssh/deploy_key
|
|
ssh -o StrictHostKeyChecking=accept-new -i ~/.ssh/deploy_key deploy@"$DEPLOY_HOST" deploy-hcsuzuki.net
|