Skip to content

Commit 0e0800b

Browse files
committed
weekly release
1 parent d5866e6 commit 0e0800b

File tree

2 files changed

+192
-52
lines changed

2 files changed

+192
-52
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -95,34 +95,6 @@ jobs:
9595
GITHUB_TOKEN: ${{ github.token }}
9696
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9797

98-
- name: tag release
99-
env:
100-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
run: |
103-
npx semantic-release
104-
105-
- name: Get release for editing
106-
id: get_release
107-
# version 1.2.4
108-
uses: cardinalby/git-get-release-action@5172c3a026600b1d459b117738c605fabc9e4e44
109-
env:
110-
GITHUB_TOKEN: ${{ github.token }}
111-
with:
112-
tag: ${{ env.VERSION_TAG }}
113-
114-
- name: Edit Release
115-
# version 1.2.0
116-
uses: irongut/EditRelease@ccf529ad26dddf9996e7dd0f24ca5da4ea507cc2
117-
with:
118-
token: ${{ secrets.GITHUB_TOKEN }}
119-
id: ${{ steps.get_release.outputs.id }}
120-
body: |
121-
## Info
122-
[See code diff](${{ github.event.compare }})
123-
[Release workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
124-
It was initialized by [${{ github.event.sender.login }}](${{ github.event.sender.html_url }})
125-
12698
package_code:
12799
needs: [tag_release, quality_checks, get_commit_id]
128100
uses: ./.github/workflows/docker_image_build.yml
@@ -165,27 +137,3 @@ jobs:
165137
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
166138
secrets:
167139
CDK_PUSH_IMAGE_ROLE: ${{ secrets.REF_CDK_PUSH_IMAGE_ROLE }}
168-
169-
release_int:
170-
needs: [tag_release, release_qa, package_code, get_commit_id]
171-
uses: ./.github/workflows/docker_image_upload.yml
172-
with:
173-
AWS_ENVIRONMENT: int
174-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
175-
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
176-
TAG_LATEST: true
177-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
178-
secrets:
179-
CDK_PUSH_IMAGE_ROLE: ${{ secrets.INT_CDK_PUSH_IMAGE_ROLE }}
180-
181-
release_prod:
182-
needs: [tag_release, release_int, package_code, get_commit_id]
183-
uses: ./.github/workflows/docker_image_upload.yml
184-
with:
185-
AWS_ENVIRONMENT: prod
186-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
187-
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
188-
TAG_LATEST: true
189-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
190-
secrets:
191-
CDK_PUSH_IMAGE_ROLE: ${{ secrets.PROD_CDK_PUSH_IMAGE_ROLE }}

.github/workflows/release.yml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Release workflow
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 8 * * 3"
7+
8+
env:
9+
BRANCH_NAME: ${{ github.ref_name }}
10+
11+
jobs:
12+
quality_checks:
13+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
14+
secrets:
15+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
16+
17+
get_commit_id:
18+
runs-on: ubuntu-22.04
19+
outputs:
20+
commit_id: ${{ steps.commit_id.outputs.commit_id }}
21+
steps:
22+
- name: Get Commit ID
23+
id: commit_id
24+
run: |
25+
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
26+
27+
tag_release:
28+
needs: quality_checks
29+
runs-on: ubuntu-22.04
30+
outputs:
31+
version_tag: ${{steps.output_version_tag.outputs.VERSION_TAG}}
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v5
35+
with:
36+
ref: ${{ env.BRANCH_NAME }}
37+
fetch-depth: 0
38+
39+
# using git commit sha for version of action to ensure we have stable version
40+
- name: Install asdf
41+
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
42+
with:
43+
asdf_branch: v0.14.1
44+
45+
- name: Cache asdf
46+
uses: actions/cache@v4
47+
with:
48+
path: |
49+
~/.asdf
50+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
51+
restore-keys: |
52+
${{ runner.os }}-asdf-
53+
54+
- name: Install asdf dependencies in .tool-versions
55+
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
56+
with:
57+
asdf_branch: v0.14.1
58+
env:
59+
PYTHON_CONFIGURE_OPTS: --enable-shared
60+
61+
- name: Setting up .npmrc
62+
env:
63+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
66+
echo "@NHSDigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
67+
68+
- name: Install node packages
69+
run: |
70+
make install-node
71+
72+
- name: Set VERSION_TAG env var to be short git SHA and get next tag version
73+
id: output_version_tag
74+
run: |
75+
VERSION_TAG=$(git rev-parse --short HEAD)
76+
npx semantic-release --dry-run > semantic-release-output.log
77+
NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/')
78+
if [ -z "${NEXT_VERSION}" ]
79+
then
80+
echo "Could not get next tag. Here is the log from semantic-release"
81+
cat semantic-release-output.log
82+
exit 1
83+
fi
84+
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
85+
if [ "${tagFormat}" = "null" ]
86+
then
87+
tagFormat="v\${version}"
88+
fi
89+
# disabling shellcheck as replace does not work
90+
# shellcheck disable=SC2001
91+
VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
92+
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
93+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
94+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
95+
env:
96+
GITHUB_TOKEN: ${{ github.token }}
97+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: tag release
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
run: |
104+
npx semantic-release
105+
106+
- name: Get release for editing
107+
id: get_release
108+
# version 1.2.4
109+
uses: cardinalby/git-get-release-action@5172c3a026600b1d459b117738c605fabc9e4e44
110+
env:
111+
GITHUB_TOKEN: ${{ github.token }}
112+
with:
113+
tag: ${{ env.VERSION_TAG }}
114+
115+
- name: Edit Release
116+
# version 1.2.0
117+
uses: irongut/EditRelease@ccf529ad26dddf9996e7dd0f24ca5da4ea507cc2
118+
with:
119+
token: ${{ secrets.GITHUB_TOKEN }}
120+
id: ${{ steps.get_release.outputs.id }}
121+
body: |
122+
## Info
123+
[See code diff](${{ github.event.compare }})
124+
[Release workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
125+
It was initialized by [${{ github.event.sender.login }}](${{ github.event.sender.html_url }})
126+
127+
package_code:
128+
needs: [tag_release, quality_checks, get_commit_id]
129+
uses: ./.github/workflows/docker_image_build.yml
130+
with:
131+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
132+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
133+
134+
release_dev:
135+
needs: [tag_release, package_code, get_commit_id]
136+
uses: ./.github/workflows/docker_image_upload.yml
137+
with:
138+
AWS_ENVIRONMENT: dev
139+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
140+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
141+
TAG_LATEST: true
142+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
143+
secrets:
144+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.DEV_CDK_PUSH_IMAGE_ROLE }}
145+
146+
release_qa:
147+
needs: [tag_release, release_dev, package_code, get_commit_id]
148+
uses: ./.github/workflows/docker_image_upload.yml
149+
with:
150+
AWS_ENVIRONMENT: qa
151+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
152+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
153+
TAG_LATEST: true
154+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
155+
secrets:
156+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.QA_CDK_PUSH_IMAGE_ROLE }}
157+
158+
release_ref:
159+
needs: [tag_release, release_dev, package_code, get_commit_id]
160+
uses: ./.github/workflows/docker_image_upload.yml
161+
with:
162+
AWS_ENVIRONMENT: ref
163+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
164+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
165+
TAG_LATEST: true
166+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
167+
secrets:
168+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.REF_CDK_PUSH_IMAGE_ROLE }}
169+
170+
release_int:
171+
needs: [tag_release, release_qa, package_code, get_commit_id]
172+
uses: ./.github/workflows/docker_image_upload.yml
173+
with:
174+
AWS_ENVIRONMENT: int
175+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
176+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
177+
TAG_LATEST: true
178+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
179+
secrets:
180+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.INT_CDK_PUSH_IMAGE_ROLE }}
181+
182+
release_prod:
183+
needs: [tag_release, release_int, package_code, get_commit_id]
184+
uses: ./.github/workflows/docker_image_upload.yml
185+
with:
186+
AWS_ENVIRONMENT: prod
187+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
188+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
189+
TAG_LATEST: true
190+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
191+
secrets:
192+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.PROD_CDK_PUSH_IMAGE_ROLE }}

0 commit comments

Comments
 (0)