Skip to content

CD

CD #163

Workflow file for this run

name: CD
on:
workflow_run:
workflows:
- CI
branches:
- trunk
types:
- completed
jobs:
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/${{ github.repository }}/makigas:latest
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: Deploy into makigas.es
needs: [docker]
runs-on: ubuntu-latest
environment: public
steps:
- name: Execute a remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
docker compose --project-directory docker/makigas/makigas pull
docker compose --project-directory docker/makigas/makigas up -d