-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (85 loc) · 3.03 KB
/
deploy.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
83
84
85
86
87
88
89
90
91
92
93
94
name: CI
on:
push:
branches: [ production ]
jobs:
build-site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/shared-deploy-steps
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Copy job file
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_CI_USER }}
key: ${{ secrets.SERVER_CI_USER_KEY }}
port: 22
source: jobs/site.hcl
target: /var/www/jobs/upolujksiazke/
- name: Build site image
uses: docker/build-push-action@v3
with:
push: true
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: registry.upolujksiazke.pl/upolujksiazke-front:latest
- name: Apply site job
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_CI_USER }}
key: ${{ secrets.SERVER_CI_USER_KEY }}
port: 22
script: |
nomad job run \
-address=https://localhost:4646 \
-ca-path=/var/www/nomad/tls/nomad-ca.pem \
-client-cert=/var/www/nomad/tls/server.pem \
-client-key=/var/www/nomad/tls/server-key.pem \
-token=$(cat /var/www/nomad/server/token.key) \
/var/www/jobs/upolujksiazke/jobs/site.hcl
build-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/shared-deploy-steps
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Copy job file
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_CI_USER }}
key: ${{ secrets.SERVER_CI_USER_KEY }}
port: 22
source: jobs/assets.hcl
target: /var/www/jobs/upolujksiazke/
- name: Build assets host image
uses: docker/build-push-action@v3
with:
push: true
file: Dockerfile.assets
cache-from: type=gha
cache-to: type=gha,mode=max
tags: registry.upolujksiazke.pl/upolujksiazke-assets:latest
- name: Apply assets job
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_CI_USER }}
key: ${{ secrets.SERVER_CI_USER_KEY }}
port: 22
script: |
nomad job run \
-address=https://localhost:4646 \
-ca-path=/var/www/nomad/tls/nomad-ca.pem \
-client-cert=/var/www/nomad/tls/server.pem \
-client-key=/var/www/nomad/tls/server-key.pem \
-token=$(cat /var/www/nomad/server/token.key) \
/var/www/jobs/upolujksiazke/jobs/assets.hcl