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