Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

CD

CD #128

Workflow file for this run

name: CD
on:
workflow_run:
workflows:
- CI
branches:
- trunk
types:
- completed
jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Release Docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Fetch git describe
id: describe
run: echo ::set-output name=describe::$(git describe)
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push latest version
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/${{ github.repository }}/makibot:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: VERSION_TAG=${{ steps.describe.outputs.describe }}
deploy:
name: Deploy into my server
needs: [release]
runs-on: ubuntu-latest
environment: public
steps:
- name: Run docker-compose remotely
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/makibot pull makibot
docker-compose --project-directory docker/makibot up -d