Skip to content

Commit d26b01f

Browse files
committed
fix workflows
1 parent 057ba5e commit d26b01f

File tree

5 files changed

+136
-14
lines changed

5 files changed

+136
-14
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: release workflow
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.ref_name }}
9+
10+
jobs:
11+
get_commit_id:
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
commit_id: ${{ steps.commit_id.outputs.commit_id }}
15+
sha_short: ${{ steps.commit_id.outputs.sha_short }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v5
20+
with:
21+
ref: ${{ env.BRANCH_NAME }}
22+
23+
- name: Get Commit ID
24+
id: commit_id
25+
run: |
26+
# echo "commit_id=${{ github.sha }}" >> "$GITHUB_ENV"
27+
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
28+
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
29+
get_asdf_version:
30+
runs-on: ubuntu-22.04
31+
outputs:
32+
asdf_version: ${{ steps.asdf-version.outputs.version }}
33+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v5
37+
38+
- name: Get asdf version
39+
id: asdf-version
40+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
41+
- name: Load config value
42+
id: load-config
43+
run: |
44+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
45+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
46+
quality_checks:
47+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@4a6d03ad51516eddc448daf454805f85fe2025b9
48+
needs: [get_asdf_version, get_commit_id]
49+
with:
50+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
51+
secrets:
52+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
53+
54+
tag_release:
55+
needs: [quality_checks, get_commit_id, get_asdf_version]
56+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@7c0d0e06afc120ec47372b479aa147ff9b453bca
57+
with:
58+
dry_run: true
59+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
60+
branch_name: main
61+
publish_package: true
62+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
63+
secrets: inherit
64+
65+
package_code:
66+
needs: [tag_release, quality_checks, get_commit_id]
67+
uses: ./.github/workflows/docker_image_build.yml
68+
with:
69+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
70+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
71+
72+
release_dev:
73+
needs: [tag_release, package_code, get_commit_id]
74+
uses: ./.github/workflows/docker_image_upload.yml
75+
with:
76+
AWS_ENVIRONMENT: dev
77+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
78+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
79+
TAG_LATEST: true
80+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
81+
secrets:
82+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.DEV_CDK_PUSH_IMAGE_ROLE }}
83+
84+
release_qa:
85+
needs: [tag_release, release_dev, package_code, get_commit_id]
86+
uses: ./.github/workflows/docker_image_upload.yml
87+
with:
88+
AWS_ENVIRONMENT: qa
89+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
90+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
91+
TAG_LATEST: true
92+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
93+
secrets:
94+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.QA_CDK_PUSH_IMAGE_ROLE }}
95+
96+
release_ref:
97+
needs: [tag_release, release_dev, package_code, get_commit_id]
98+
uses: ./.github/workflows/docker_image_upload.yml
99+
with:
100+
AWS_ENVIRONMENT: ref
101+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
102+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
103+
TAG_LATEST: true
104+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
105+
secrets:
106+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.REF_CDK_PUSH_IMAGE_ROLE }}

.github/workflows/package_npm_code.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,26 @@ on:
44
workflow_call:
55

66
jobs:
7+
get_asdf_version:
8+
runs-on: ubuntu-22.04
9+
outputs:
10+
asdf_version: ${{ steps.asdf-version.outputs.version }}
11+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Get asdf version
17+
id: asdf-version
18+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
19+
- name: Load config value
20+
id: load-config
21+
run: |
22+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
23+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
724
package_npm_code:
825
runs-on: ubuntu-22.04
26+
needs: [get_asdf_version]
927
steps:
1028
- name: Checkout code
1129
uses: actions/checkout@v5
@@ -14,9 +32,9 @@ jobs:
1432

1533
# using git commit sha for version of action to ensure we have stable version
1634
- name: Install asdf
17-
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
35+
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
1836
with:
19-
asdf_branch: v0.14.1
37+
asdf_version: ${{ needs.get_asdf_version.outputs.asdf_version }}
2038

2139
- name: Cache asdf
2240
uses: actions/cache@v4
@@ -25,12 +43,12 @@ jobs:
2543
~/.asdf
2644
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
2745
restore-keys: |
28-
${{ runner.os }}-asdf-
46+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
2947
3048
- name: Install asdf dependencies in .tool-versions
31-
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
49+
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
3250
with:
33-
asdf_branch: v0.14.1
51+
asdf_version: ${{ needs.get_asdf_version.outputs.asdf_version }}
3452
env:
3553
PYTHON_CONFIGURE_OPTS: --enable-shared
3654

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ jobs:
105105
needs: [get_commit_id, get_asdf_version]
106106
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@7c0d0e06afc120ec47372b479aa147ff9b453bca
107107
with:
108-
dry_run: false
108+
dry_run: true
109109
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
110-
branch_name: cdk_construct
110+
branch_name: main
111111
publish_package: true
112112
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
113113
secrets: inherit

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: merge to main workflow
1+
name: release workflow
22

33
on:
4-
push:
5-
branches: [main]
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 8 * * 3"
67

78
env:
89
BRANCH_NAME: ${{ github.ref_name }}
@@ -68,9 +69,6 @@ jobs:
6869
with:
6970
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
7071
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
71-
package_npm_code:
72-
needs: [tag_release, quality_checks, get_commit_id]
73-
uses: ./.github/workflows/package_npm_code.yml
7472

7573
release_dev:
7674
needs: [tag_release, package_code, get_commit_id]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ lint: lint-node lint-githubactions lint-githubaction-scripts
3232
clean:
3333
rm -rf packages/cdkConstructs/lib
3434
rm -rf packages/cdkConstructs/coverage
35-
rm -f packages/cdkConstructs/NHSDigital-eps-cdk-constructs-1.0.0.tgz
35+
rm -rf lib
3636

3737
deep-clean: clean
3838
rm -rf .venv

0 commit comments

Comments
 (0)