generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
141 lines (135 loc) · 4.96 KB
/
release_to_github.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Release to GitHub
on:
push:
branches:
- master
- production
concurrency: ${{ github.ref }}-gh-release
jobs:
wf_vars:
name: Set workflow variables
runs-on: ubuntu-latest
outputs:
env_name: ${{ steps.build_vars.outputs.env_name }}
version: ${{ steps.build_vars.outputs.version }}
prerelease: ${{ steps.build_vars.outputs.prerelease }}
enable_builds: 'true'
steps:
- name: Check out changes
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0
- name: Build vars
id: build_vars
uses: ./.github/actions/build-vars
build_router:
name: Build router
needs:
- wf_vars
runs-on: ubuntu-latest
defaults:
run:
working-directory: prime-router
steps:
- name: Check out changes
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Build backend
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }}
uses: ./.github/actions/build-backend
with:
version: ${{ needs.wf_vars.outputs.version }}
build_frontend:
name: Build frontend
needs:
- wf_vars
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend-react
steps:
- name: Check out changes
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Build frontend
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }}
uses: ./.github/actions/build-frontend
with:
env-name: ${{ needs.wf_vars.outputs.env_name }}
appinsights-staging-key: ${{ secrets.APPINSIGHTS_STAGING_KEY }}
appinsights-prod-key: ${{ secrets.APPINSIGHTS_PROD_KEY }}
version: ${{ needs.wf_vars.outputs.version }}
test-admin-user: ${{ secrets.TEST_ADMIN_USERNAME }}
test-admin-password: ${{ secrets.TEST_ADMIN_PASSWORD }}
test-sender-user: ${{ secrets.TEST_SENDER_USERNAME }}
test-sender-password: ${{ secrets.TEST_SENDER_PASSWORD }}
test-receiver-user: ${{ secrets.TEST_RECEIVER_USERNAME }}
test-receiver-password: ${{ secrets.TEST_RECEIVER_PASSWORD }}
publish_github_release:
name: Publish to Github
needs:
- wf_vars
- build_router
- build_frontend
runs-on: ubuntu-latest
steps:
- name: Check out changes
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0
- name: Download router artifact
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: prime-router-build-${{ needs.wf_vars.outputs.version }}
path: archives/
- name: Download frontend artifact
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: static-website-react-${{ needs.wf_vars.outputs.version }}
path: archives/
- name: Delete older pre-release
if: |
${{ needs.wf_vars.outputs.env_name == 'staging' }} ||
${{ needs.wf_vars.outputs.env_name == 'prod' }}
uses: dev-drprasad/delete-older-releases@dfbe6be2a006e9475dfcbe5b8d201f1824c2a9fe
with:
keep_latest: 0
delete_tags: true
delete_tag_pattern: 'pre-release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.wf_vars.outputs.version }}
allowUpdates: true
artifacts: "archives/*.tar.gz,LICENSE"
prerelease: ${{ needs.wf_vars.outputs.prerelease }}
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@32e3c96f29a6532607f638797455e9e98cfc703d
with:
configuration: '.github/changelog_config.json'
# Allow changelog tests in forks
owner: 'CDCgov'
repo: 'prime-reportstream'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update release notes
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.wf_vars.outputs.version }}
allowUpdates: true
body: ${{steps.build_changelog.outputs.changelog}}
prerelease: ${{ needs.wf_vars.outputs.prerelease }}
- name: Delete older releases
if: ${{ needs.wf_vars.outputs.env_name == 'prod' }}
uses: dev-drprasad/delete-older-releases@dfbe6be2a006e9475dfcbe5b8d201f1824c2a9fe
with:
keep_latest: 24
delete_tags: false
delete_tag_pattern: 'v-20'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}