Skip to content

Commit 0b46f79

Browse files
committed
do not use asdf in tag-release
1 parent a0cc5f7 commit 0b46f79

4 files changed

Lines changed: 25 additions & 166 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ jobs:
1919
get_config_values:
2020
runs-on: ubuntu-22.04
2121
outputs:
22-
asdf_version: ${{ steps.asdf-version.outputs.version }}
2322
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
2423
devcontainer_version: ${{ steps.load-config.outputs.DEVCONTAINER_VERSION }}
2524
devcontainer_image: ${{ steps.load-config.outputs.DEVCONTAINER_IMAGE }}
2625
steps:
2726
- name: Checkout code
2827
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2928

30-
- name: Get asdf version
31-
id: asdf-version
32-
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
3329
- name: Load config value
3430
id: load-config
3531
run: |
@@ -53,7 +49,7 @@ jobs:
5349
uses: ./.github/workflows/tag-release.yml
5450
with:
5551
dry_run: true
56-
asdfVersion: ${{ needs.get_config_values.outputs.asdf_version }}
52+
runtime_docker_image: "${{ needs.get_config_values.outputs.devcontainer_image }}:githubactions-${{ needs.get_config_values.outputs.devcontainer_version }}"
5753
branch_name: ${{ github.event.pull_request.head.ref }}
5854
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
5955
secrets: inherit

.github/workflows/quality-checks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
name: copy .tool-versions
4040
run: |
4141
cp /home/vscode/.tool-versions "$HOME/.tool-versions"
42-
sudo usermod -aG docker vscode
4342
4443
- &checkout
4544
name: Checkout code

.github/workflows/release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ jobs:
1111
get_config_values:
1212
runs-on: ubuntu-22.04
1313
outputs:
14-
asdf_version: ${{ steps.asdf-version.outputs.version }}
1514
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
1615
devcontainer_version: ${{ steps.load-config.outputs.DEVCONTAINER_VERSION }}
1716
steps:
1817
- name: Checkout code
1918
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2019

21-
- name: Get asdf version
22-
id: asdf-version
23-
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
2420
- name: Load config value
2521
id: load-config
2622
run: |
@@ -40,7 +36,7 @@ jobs:
4036
uses: ./.github/workflows/tag-release.yml
4137
with:
4238
dry_run: false
43-
asdfVersion: ${{ needs.get_config_values.outputs.asdf_version }}
39+
runtime_docker_image: "ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_14:${{ needs.get_config_values.outputs.devcontainer_version }}"
4440
branch_name: main
4541
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
4642
secrets: inherit

.github/workflows/tag-release.yml

Lines changed: 23 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ on:
1111
description: "The branch name to base the release on"
1212
required: true
1313
type: string
14-
asdfVersion:
14+
runtime_docker_image:
1515
type: string
16-
required: false
17-
default: "0.18.0"
16+
required: true
1817
publish_packages:
1918
description: "comma separated list of package folders to publish to an npm registry"
2019
required: false
@@ -60,156 +59,43 @@ on:
6059
required: false
6160
description: "NPM token to publish packages"
6261
jobs:
63-
install_semantic_release:
64-
# Install asdf
65-
# Use npm install -g to install semantic release and plugins globally
66-
## These are installed in the asdf npm version
67-
# Bundle .asdf and upload as artifact
62+
tag_release:
6863
runs-on: ubuntu-22.04
64+
container:
65+
image: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.runtime_docker_image }}
66+
options: --user 1001:1001 --group-add 128
67+
defaults:
68+
run:
69+
shell: bash
70+
outputs:
71+
version_tag: ${{steps.output_version_tag.outputs.VERSION_TAG}}
72+
change_set_version: ${{ steps.output_change_set_version.outputs.CHANGE_SET_VERSION }}
73+
next_version_tag: ${{ steps.output_version_tag.outputs.NEXT_VERSION_TAG }}
6974
steps:
75+
- name: copy .tool-versions
76+
run: |
77+
cp /home/vscode/.tool-versions "$HOME/.tool-versions"
7078
- name: Checkout semantic-release workflow
7179
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
7280
with:
7381
repository: NHSDigital/eps-common-workflows
7482
sparse-checkout-cone-mode: false
83+
path: eps-common-workflows
7584
sparse-checkout: |
7685
package.json
7786
package-lock.json
7887
.tool-versions
7988
release.config.cjs
8089
releaseNotesTemplates/commit.hbs
81-
82-
- name: Calculate asdf cache key
83-
id: asdf_cache_key
84-
run: |
85-
base="${{ runner.os }}-asdf-${{ inputs.asdfVersion }}"
86-
key="$base-${{ hashFiles('**/.tool-versions') }}"
87-
88-
echo "base=$base" >> "$GITHUB_OUTPUT"
89-
echo "key=$key" >> "$GITHUB_OUTPUT"
90-
91-
- name: Calculate installed cache key
92-
id: installed_cache_key
93-
run: |
94-
base="${{ steps.asdf_cache_key.outputs.key }}-npm"
95-
key="$base-${{ hashFiles('**/package-lock.json') }}"
96-
97-
echo "base=$base" >> "$GITHUB_OUTPUT"
98-
echo "key=$key" >> "$GITHUB_OUTPUT"
99-
100-
- name: Calculate artifact cache key
101-
id: artifact_cache_key
102-
run: |
103-
base="${{ steps.installed_cache_key.outputs.key }}"
104-
key="$base-artifact"
105-
106-
echo "base=$base" >> "$GITHUB_OUTPUT"
107-
echo "key=$key" >> "$GITHUB_OUTPUT"
108-
109-
- name: Cache asdf artifact
110-
id: asdf_artifact_cache
111-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
112-
with:
113-
path: asdf.tar.gz
114-
key: ${{ steps.artifact_cache_key.outputs.key }}
115-
restore-keys: ${{ steps.artifact_cache_key.outputs.base }}*
116-
117-
- name: Cache asdf with installed npm packages
118-
if: ${{ steps.asdf_artifact_cache.outputs.cache-hit != 'true' }}
119-
id: installed_cache
120-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
121-
with:
122-
path: ~/.asdf
123-
key: ${{ steps.installed_cache_key.outputs.key }}
124-
restore-keys: ${{ steps.installed_cache_key.outputs.base }}*
125-
126-
- name: Cache asdf
127-
if: ${{ steps.installed_cache.outcome == 'success' && steps.installed_cache.outputs.cache-hit != 'true' }}
128-
id: asdf_cache
129-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
130-
with:
131-
path: ~/.asdf
132-
key: ${{ steps.asdf_cache_key.outputs.key }}
133-
restore-keys: |
134-
${{ steps.asdf_cache_key.outputs.base }}*
135-
136-
- name: Install asdf dependencies in .tool-versions
137-
if: ${{ steps.asdf_cache.outputs.cache-hit == 'false' || steps.asdf_cache.outcome != 'skipped' }}
138-
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
139-
with:
140-
asdf_version: ${{ inputs.asdfVersion }}
141-
14290
- name: Install semantic release dependencies globally
143-
if: ${{ steps.installed_cache.outputs.cache-hit == 'false' || steps.installed_cache.outcome != 'skipped' }}
14491
run: |
92+
cd eps-common-workflows
14593
dependencies="$(jq -r '.devDependencies | to_entries | map("\(.key)@\(.value)") | join(" ")' package.json)"
14694
echo "Installing: $dependencies"
14795
14896
# shellcheck disable=SC2086
14997
npm install --global $dependencies
15098
151-
- name: Prepare asdf artifact
152-
if: ${{ steps.asdf_artifact_cache.outputs.cache-hit != 'true' }}
153-
run: |
154-
tar -czf asdf.tar.gz -C "$HOME" .asdf
155-
156-
- name: Upload asdf artifact
157-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
158-
with:
159-
name: asdf_artifact
160-
path: asdf.tar.gz
161-
overwrite: true
162-
163-
- name: Prepare config artifact
164-
run: |
165-
mkdir -p config_artifact/releaseNotesTemplates
166-
cp release.config.cjs config_artifact/
167-
cp releaseNotesTemplates/commit.hbs config_artifact/releaseNotesTemplates/
168-
169-
- name: Upload config artifact
170-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
171-
with:
172-
name: config_artifact
173-
path: config_artifact/
174-
overwrite: true
175-
176-
tag_release:
177-
needs: install_semantic_release
178-
runs-on: ubuntu-22.04
179-
outputs:
180-
version_tag: ${{steps.output_version_tag.outputs.VERSION_TAG}}
181-
change_set_version: ${{ steps.output_change_set_version.outputs.CHANGE_SET_VERSION }}
182-
next_version_tag: ${{ steps.output_version_tag.outputs.NEXT_VERSION_TAG }}
183-
steps:
184-
- name: Fetch asdf artifact
185-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
186-
with:
187-
name: asdf_artifact
188-
- name: Install asdf
189-
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
190-
with:
191-
asdf_version: ${{ inputs.asdfVersion }}
192-
193-
- name: Extract asdf
194-
run: tar -xzf asdf.tar.gz -C "$HOME"
195-
196-
- name: Setup node from cache
197-
run: |
198-
# Get installed node version (trim whitespace with xargs)
199-
NODE_VER=$(asdf list nodejs | head -n1 | xargs)
200-
NODE_DIR="$HOME/.asdf/installs/nodejs/$NODE_VER"
201-
202-
echo "Using Node $NODE_VER from cache at $NODE_DIR"
203-
asdf set -u nodejs "$NODE_VER"
204-
205-
# Prepend binaries to path
206-
echo "$NODE_DIR/bin" >> "$GITHUB_PATH"
207-
echo "$NODE_DIR/lib/node_modules/.bin" >> "$GITHUB_PATH"
208-
209-
# # Set node path to resolve packages
210-
# NODE_PATH="$NODE_DIR/lib/node_modules"
211-
# echo "NODE_PATH=$NODE_PATH" >> $GITHUB_ENV
212-
21399
- name: Clone calling repo
214100
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
215101
with:
@@ -225,29 +111,6 @@ jobs:
225111
env:
226112
BRANCH_NAME: ${{ inputs.branch_name }}
227113

228-
- name: Fetch semantic-release config
229-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
230-
with:
231-
name: config_artifact
232-
233-
- name: Cache asdf
234-
if: inputs.publish_packages != ''
235-
uses: actions/cache@v5
236-
with:
237-
path: |
238-
~/.asdf
239-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
240-
restore-keys: |
241-
${{ runner.os }}-asdf-
242-
243-
- name: Install asdf dependencies in .tool-versions
244-
if: inputs.publish_packages != ''
245-
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
246-
with:
247-
asdf_version: ${{ inputs.asdfVersion }}
248-
env:
249-
PYTHON_CONFIGURE_OPTS: --enable-shared
250-
251114
- name: Install Dependencies and Build Package
252115
if: inputs.publish_packages != ''
253116
run: |
@@ -262,6 +125,11 @@ jobs:
262125
github-token: ${{ secrets.GITHUB_TOKEN }}
263126
repository: ${{ inputs.extra_artifact_repository }}
264127
run-id: ${{ inputs.extra_artifact_run_id }}
128+
- name: Copy semantic release config
129+
run: |
130+
cp eps-common-workflows/release.config.cjs .
131+
mkdir -p releaseNotesTemplates
132+
cp eps-common-workflows/releaseNotesTemplates/commit.hbs releaseNotesTemplates/
265133
266134
- name: Set VERSION_TAG based on dry_run flag
267135
id: output_version_tag

0 commit comments

Comments
 (0)