@@ -22,100 +22,35 @@ jobs:
2222 run : |
2323 echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
2424
25- tag_release :
26- needs : quality_checks
25+ get_asdf_version :
2726 runs-on : ubuntu-22.04
2827 outputs :
29- version_tag : ${{ steps.output_version_tag.outputs.VERSION_TAG }}
28+ asdf_version : ${{ steps.asdf-version.outputs.version }}
29+ tag_format : ${{ steps.load-config.outputs.TAG_FORMAT }}
3030 steps :
3131 - name : Checkout code
3232 uses : actions/checkout@v5
33- with :
34- ref : ${{ env.BRANCH_NAME }}
35- fetch-depth : 0
3633
3734 - name : Get asdf version
3835 id : asdf-version
3936 run : echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
4037
41- # using git commit sha for version of action to ensure we have stable version
42- - name : Install asdf
43- uses : asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
44- with :
45- asdf_version : ${{ steps.asdf-version.outputs.version }}
46-
47- - name : Cache asdf
48- uses : actions/cache@v4
49- with :
50- path : |
51- ~/.asdf
52- key : ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
53- restore-keys : |
54- ${{ runner.os }}-asdf-
55-
56- - name : Install asdf dependencies in .tool-versions
57- uses : asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
58- with :
59- asdf_version : ${{ steps.asdf-version.outputs.version }}
60- env :
61- PYTHON_CONFIGURE_OPTS : --enable-shared
62-
63- - name : Setting up .npmrc
64- env :
65- NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66- run : |
67- echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
68- echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
69-
70- - name : Install dependencies
71- run : |
72- make install
73-
74- - name : Set VERSION_TAG to be next tag varsion
75- id : output_version_tag
76- run : |
77- NEXT_VERSION=$(npx semantic-release --dry-run | grep -i 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/')
78- tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
79- if [ "${tagFormat}" = "null" ]
80- then
81- tagFormat="v\${version}"
82- fi
83- # disabling shellcheck as replace does not work
84- # shellcheck disable=SC2001
85- VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
86- echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
87- echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
88- echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
89- env :
90- GITHUB_TOKEN : ${{ github.token }}
91-
92- - name : tag release
93- env :
94- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38+ - name : Load config value
39+ id : load-config
9540 run : |
96- npx semantic-release
97-
98- - name : Get release for editing
99- id : get_release
100- # version 1.2.4
101- uses : cardinalby/git-get-release-action@5172c3a026600b1d459b117738c605fabc9e4e44
102- env :
103- GITHUB_TOKEN : ${{ github.token }}
104- with :
105- tag : ${{ env.VERSION_TAG }}
41+ TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
42+ echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
10643
107- - name : Edit Release
108- # version 1.2.0
109- uses : irongut/EditRelease@ccf529ad26dddf9996e7dd0f24ca5da4ea507cc2
110- with :
111- token : ${{ secrets.GITHUB_TOKEN }}
112- id : ${{ steps.get_release.outputs.id }}
113- body : |
114- ## Info
115- [See code diff](${{ github.event.compare }})
116- [Release workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
117-
118- It was initialized by [${{ github.event.sender.login }}](${{ github.event.sender.html_url }})
44+ tag_release :
45+ needs : [quality_checks, get_commit_id, get_asdf_version]
46+ uses : NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@f80157cecce288dd175e61b477a1d2dbe9c88b99
47+ with :
48+ dry_run : false
49+ asdfVersion : ${{ needs.get_asdf_version.outputs.asdf_version }}
50+ branch_name : main
51+ publish_package : false
52+ tag_format : ${{ needs.get_asdf_version.outputs.tag_format }}
53+ secrets : inherit
11954
12055 package_code :
12156 needs : [get_commit_id, tag_release]
0 commit comments