-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (77 loc) · 2.03 KB
/
build-deploy-on-push.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build & deploy server container (test)
on:
push:
branches:
- main
paths:
- .github/actions/docker-build-push/action.yml
- .github/actions/version/action.yml
- .github/workflows/build-deploy-on-push.yml
- server/**
workflow_dispatch:
concurrency:
group: docker-build
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
name: Build container
strategy:
matrix:
include:
-
container: server
tag: dev
-
container: server
tag: latest
-
container: nginx
tag: latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get version
id: version
if: matrix.container == 'server'
uses: ./.github/actions/version
-
name: Build container (server)
uses: ./.github/actions/docker-build-push
if: matrix.container == 'server'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: server
tag: ${{ matrix.tag }}
build-args: |
DEBUG=${{ matrix.tag == 'dev' && '1' || '0' }}
TOMATO_VERSION=${{ steps.version.outputs.version }}
-
name: Build container (nginx)
uses: ./.github/actions/docker-build-push
if: matrix.container == 'nginx'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: nginx
context: server/nginx
tag: ${{ matrix.tag }}
deploy:
runs-on: ubuntu-22.04
name: Deploy
needs: [build]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Deploy containers
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
fingerprint: ${{ secrets.SSH_FINGERPRINT }}
script: ${{ secrets.DEPLOY_TEST_SCRIPT_PATH }}