Skip to content

Commit 8494fd8

Browse files
committed
move to common tagging
1 parent 7145d5f commit 8494fd8

File tree

12 files changed

+3281
-9290
lines changed

12 files changed

+3281
-9290
lines changed

.devcontainer/Dockerfile

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM mcr.microsoft.com/devcontainers/base:ubuntu
33
ARG TARGETARCH
44
ENV TARGETARCH=${TARGETARCH}
55

6+
ARG ASDF_VERSION
7+
COPY .tool-versions.asdf /tmp/.tool-versions.asdf
8+
69
# Add amd64 architecture if on arm64
710
RUN if [ "$TARGETARCH" == "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then dpkg --add-architecture amd64; fi
811

@@ -27,17 +30,23 @@ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
2730
/tmp/aws-cli/aws/install && \
2831
rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
2932

33+
# Install ASDF
34+
RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
35+
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
36+
wget -O /tmp/asdf.tar.gz "https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz"; \
37+
else \
38+
wget -O /tmp/asdf.tar.gz "https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz"; \
39+
fi && \
40+
tar -xzf /tmp/asdf.tar.gz -C /tmp && \
41+
mkdir -p /usr/bin && \
42+
mv /tmp/asdf /usr/bin/asdf && \
43+
chmod +x /usr/bin/asdf && \
44+
rm -rf /tmp/asdf.tar.gz
45+
3046
USER vscode
3147

32-
# Install ASDF
33-
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
34-
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
35-
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; \
36-
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
37-
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
38-
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
3948

40-
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-vpc-resources/node_modules/.bin"
49+
ENV PATH="$PATH:/home/vscode/.asdf/shims/:/workspaces/eps-vpc-resources/node_modules/.bin"
4150

4251

4352
# Install ASDF plugins
@@ -54,8 +63,5 @@ WORKDIR /workspaces/eps-vpc-resources
5463
ADD .tool-versions /workspaces/eps-resources/.tool-versions
5564
ADD .tool-versions /home/vscode/.tool-versions
5665

57-
RUN asdf install; \
58-
asdf reshim python; \
59-
asdf reshim poetry; \
60-
asdf reshim nodejs; \
61-
asdf direnv setup --shell bash --version 2.32.2;
66+
RUN asdf install python; \
67+
asdf install

.github/config/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TAG_FORMAT: "v${version}-beta"

.github/workflows/cdk_package_code.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
required: true
1111
type: string
1212

13-
1413
jobs:
1514
package_code:
1615
runs-on: ubuntu-22.04
@@ -24,25 +23,29 @@ jobs:
2423
with:
2524
ref: ${{ env.BRANCH_NAME }}
2625

26+
- name: Get asdf version
27+
id: asdf-version
28+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
29+
2730
# using git commit sha for version of action to ensure we have stable version
2831
- name: Install asdf
2932
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
3033
with:
31-
asdf_branch: v0.14.1
32-
34+
asdf_version: ${{ steps.asdf-version.outputs.version }}
35+
3336
- name: Cache asdf
3437
uses: actions/cache@v4
3538
with:
3639
path: |
3740
~/.asdf
38-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
41+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ steps.asdf-version.outputs.version }}
3942
restore-keys: |
40-
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
43+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ steps.asdf-version.outputs.version }}
4144
4245
- name: Install asdf dependencies in .tool-versions
4346
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
4447
with:
45-
asdf_branch: v0.14.1
48+
asdf_version: ${{ steps.asdf-version.outputs.version }}
4649
env:
4750
PYTHON_CONFIGURE_OPTS: --enable-shared
4851

@@ -51,7 +54,7 @@ jobs:
5154
make install
5255
make compile-node
5356
54-
- name: 'Tar files'
57+
- name: "Tar files"
5558
run: |
5659
tar -rf artifact.tar \
5760
.tool-versions \

.github/workflows/ci.yml

Lines changed: 21 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,69 +23,34 @@ jobs:
2323
run: |
2424
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
2525
26-
tag_release:
27-
needs: quality_checks
26+
get_asdf_version:
2827
runs-on: ubuntu-22.04
2928
outputs:
30-
version_tag: ${{ steps.output_version_tag.outputs.VERSION_TAG }}
29+
asdf_version: ${{ steps.asdf-version.outputs.version }}
30+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
3131
steps:
3232
- name: Checkout code
3333
uses: actions/checkout@v5
34-
with:
35-
ref: ${{ env.BRANCH_NAME }}
36-
fetch-depth: 0
37-
38-
# using git commit sha for version of action to ensure we have stable version
39-
- name: Install asdf
40-
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
41-
with:
42-
asdf_branch: v0.14.1
43-
44-
- name: Cache asdf
45-
uses: actions/cache@v4
46-
with:
47-
path: |
48-
~/.asdf
49-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
50-
restore-keys: |
51-
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
52-
53-
- name: Install asdf dependencies in .tool-versions
54-
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
55-
with:
56-
asdf_branch: v0.14.1
57-
env:
58-
PYTHON_CONFIGURE_OPTS: --enable-shared
59-
60-
- name: Install Dependencies
61-
run: make install
6234

63-
- name: Set VERSION_TAG env var to be short git SHA and get next tag varsion
64-
id: output_version_tag
35+
- name: Get asdf version
36+
id: asdf-version
37+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
38+
- name: Load config value
39+
id: load-config
6540
run: |
66-
VERSION_TAG=$(git rev-parse --short HEAD)
67-
npx semantic-release --dry-run > semantic-release-output.log
68-
NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/')
69-
if [ -z "${NEXT_VERSION}" ]
70-
then
71-
echo "Could not get next tag. Here is the log from semantic-release"
72-
cat semantic-release-output.log
73-
exit 1
74-
fi
75-
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
76-
if [ "${tagFormat}" = "null" ]
77-
then
78-
tagFormat="v\${version}"
79-
fi
80-
# disabling shellcheck as replace does not work
81-
# shellcheck disable=SC2001
82-
NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
83-
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
84-
echo "## NEXT TAG WILL BE : ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
85-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
86-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
87-
env:
88-
GITHUB_TOKEN: ${{ github.token }}
41+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
42+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
43+
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@2a3f4ab96e04b7547c4ee5b786745b98809c89be
47+
with:
48+
dry_run: true
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
8954

9055
package_code:
9156
needs: [tag_release, get_commit_id]
@@ -122,7 +87,6 @@ jobs:
12287
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
12388
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
12489

125-
12690
release_qa:
12791
needs: [tag_release, release_dev, package_code, get_commit_id]
12892
uses: ./.github/workflows/cdk_release_code.yml

.github/workflows/pr_title_check.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1515

1616
pr_title_format_check:
17-
uses: ./.github/workflows/pr_title_check.yml
17+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/pr_title_check.yml@7abf2a3233d1b08d6566570dbde34b85daa47859
1818

1919
get_issue_number:
2020
runs-on: ubuntu-22.04
@@ -42,6 +42,35 @@ jobs:
4242
}
4343
result-encoding: string
4444

45+
get_asdf_version:
46+
runs-on: ubuntu-22.04
47+
outputs:
48+
asdf_version: ${{ steps.asdf-version.outputs.version }}
49+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v5
53+
54+
- name: Get asdf version
55+
id: asdf-version
56+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
57+
- name: Load config value
58+
id: load-config
59+
run: |
60+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
61+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
62+
63+
tag_release:
64+
needs: [get_asdf_version]
65+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@2a3f4ab96e04b7547c4ee5b786745b98809c89be
66+
with:
67+
dry_run: true
68+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
69+
branch_name: ${{ github.event.pull_request.head.ref }}
70+
publish_package: false
71+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
72+
secrets: inherit
73+
4574
get_commit_id:
4675
runs-on: ubuntu-22.04
4776
outputs:
@@ -51,7 +80,7 @@ jobs:
5180
id: commit_id
5281
run: |
5382
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
54-
83+
5584
package_code:
5685
needs: [quality_checks, get_issue_number, get_commit_id]
5786
uses: ./.github/workflows/cdk_package_code.yml

0 commit comments

Comments
 (0)