-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (74 loc) · 2.42 KB
/
release_and_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
name: Release and Deploy
on:
workflow_dispatch:
inputs:
commit:
description: "Leave blank to use current HEAD, or provide an override commit SHA"
type: string
required: false
jobs:
ref:
name: Load Commit Ref
runs-on: ubuntu-latest
steps:
- id: ref
uses: passportxyz/gh-workflows/.github/actions/load_commit_ref@main
with:
commit: ${{ inputs.commit }}
outputs:
version_tag: ${{ steps.ref.outputs.version_tag }}
docker_tag: ${{ steps.ref.outputs.docker_tag }}
refspec: ${{ steps.ref.outputs.refspec }}
push_to_staging:
name: Push to Staging
needs: ref
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to Staging Branch
uses: passportxyz/gh-workflows/.github/actions/push_to_branch@main
with:
commit: ${{ needs.ref.outputs.refspec }}
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: "staging-app"
outputs:
deployed-commit: ${{ steps.push_to_branch.outputs.deployed-commit }}
wait_for_production_approval:
name: Production Approval Pending
needs: [ref, push_to_staging]
runs-on: ubuntu-latest
environment: production
steps:
- name: Approve Release to Production
run: |
echo "Approved Production Release for: " ${{ needs.ref.outputs.version_tag }}
echo "Ref: ${{ needs.ref.outputs.refspec }}"
push_to_production:
name: Push to Production
needs: [ref, wait_for_production_approval]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to Production Branch
uses: passportxyz/gh-workflows/.github/actions/push_to_branch@main
with:
commit: ${{ needs.ref.outputs.refspec }}
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: "production-app"
outputs:
deployed-commit: ${{ steps.push_to_branch.outputs.deployed-commit }}
deployment_info:
name: Display Deployment Information
needs: [ref, push_to_staging, push_to_production]
runs-on: ubuntu-latest
steps:
- name: Show Deployment Details
run: |
echo "Version Tag: ${{ needs.ref.outputs.version_tag }}"
echo "Docker Tag: ${{ needs.ref.outputs.docker_tag }}