-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.47 KB
/
image-to-docker-hub.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
name: Docker Image CI
on:
workflow_run:
workflows: ["Lint, Test and Build"]
types:
- completed
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- id: docker-build
uses: ./.github/actions/docker-build
with:
vps-host: ${{ secrets.API_HOST_PROD }}
vue-app-api-ver: ${{ secrets.VUE_APP_API_VER }}
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
push: 'true'
- name: Image digest
run: echo ${{ steps.docker-build.outputs.docker-build-digest }}
- name: Actualize docker images on VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USERNAME }}
key: ${{ secrets.VPS_SSH_KEY }}
passphrase: ${{ secrets.VPS_SSH_KEY_PASSPHRASE }}
script_stop: true
script: |
cd ${{ secrets.VPS_PROJECT_PATH }}
# Pull the latest image
docker-compose pull
# Start the new containers without dependencies, so there will be almost
# no downtime
docker-compose up -d --no-deps