This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (53 loc) · 1.58 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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