-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (66 loc) · 2.04 KB
/
trigger-deployments.yml
File metadata and controls
69 lines (66 loc) · 2.04 KB
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
name: Trigger deployment on test then prod
on:
push:
tags:
- '*'
env:
TAG_TO_DEPLOY: ${{ github.ref_name }}
jobs:
on-main-branch-check:
runs-on: ubuntu-latest
outputs:
on_main: ${{ steps.contains_tag.outputs.retval }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: rickstaa/action-contains-tag@v1
id: contains_tag
with:
reference: "main"
tag: "${{ env.TAG_TO_DEPLOY }}"
trigger-test-deployment:
runs-on: ubuntu-latest
environment: test
env:
BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }}
BUILD_SSH_PUBLIC_KEY: ${{ secrets.BUILD_SSH_PUBLIC_KEY }}
MACHINE_ADDRESS: ${{ secrets.MACHINE_ADDRESS }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
steps:
- name: Check out repository code to access trigger_deployment.sh
uses: actions/checkout@v4
- run: ./trigger_deployment.sh
- uses: artiz/poll-endpoint@1.0.2
with:
url: ${{ secrets.DEPLOYED_VERSION_URL }}
method: GET
expectStatus: 200
expectBodyRegex: "^${{ env.TAG_TO_DEPLOY }}\\W*$"
timeout: 600000
interval: 20000
trigger-production-deployment:
needs:
- trigger-test-deployment
- on-main-branch-check
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}
runs-on: ubuntu-latest
environment: production
env:
BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }}
BUILD_SSH_PUBLIC_KEY: ${{ secrets.BUILD_SSH_PUBLIC_KEY }}
MACHINE_ADDRESS: ${{ secrets.MACHINE_ADDRESS }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
steps:
- name: Check out repository code to access trigger_deployment.sh
uses: actions/checkout@v4
- run: ./trigger_deployment.sh
- uses: artiz/poll-endpoint@1.0.2
with:
url: ${{ secrets.DEPLOYED_VERSION_URL }}
method: GET
expectStatus: 200
expectBodyRegex: "^${{ env.TAG_TO_DEPLOY }}\\W*$"
timeout: 600000
interval: 20000