Skip to content

Commit b93ce18

Browse files
authored
Chore: [AEA-4183] - Add semantic release (#7)
## Summary - Routine Change - 🤖 Operational or Infrastructure Change ### Details Adds semantic release and related supporting config/resources.
1 parent a05d7a2 commit b93ce18

File tree

9 files changed

+7329
-0
lines changed

9 files changed

+7329
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,20 @@ RUN apt-get update \
1313

1414
USER vscode
1515

16+
# Install ASDF
17+
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
18+
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
19+
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc;
20+
21+
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin"
22+
23+
# Install ASDF plugins#
24+
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
25+
1626
WORKDIR /workspaces/eps-workflow-quality-checks
27+
28+
ADD .tool-versions /workspaces/eps-workflow-quality-checks/.tool-versions
29+
ADD .tool-versions /home/vscode/.tool-versions
30+
31+
RUN asdf install; \
32+
asdf reshim nodejs;

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: merge to main workflow
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
9+
10+
jobs:
11+
tag_release:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
version_tag: ${{ steps.output_version_tag.outputs.VERSION_TAG }}
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ env.BRANCH_NAME }}
20+
fetch-depth: 0
21+
22+
# using git commit sha for version of action to ensure we have stable version
23+
- name: Install asdf
24+
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
25+
with:
26+
asdf_branch: v0.14.1
27+
28+
- name: Cache asdf
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.asdf
33+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
34+
restore-keys: |
35+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
36+
37+
- name: Install asdf dependencies in .tool-versions
38+
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
39+
with:
40+
asdf_branch: v0.14.1
41+
42+
- name: Install dependencies
43+
run: |
44+
make install
45+
46+
- name: Set VERSION_TAG to be next tag varsion
47+
id: output_version_tag
48+
run: |
49+
NEXT_VERSION=$(npx semantic-release --dry-run | grep -i 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/')
50+
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
51+
if [ "${tagFormat}" = "null" ]
52+
then
53+
tagFormat="v\${version}"
54+
fi
55+
# disabling shellcheck as replace does not work
56+
# shellcheck disable=SC2001
57+
VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
58+
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
59+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
60+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
61+
env:
62+
GITHUB_TOKEN: ${{ github.token }}
63+
64+
- name: tag release
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
run: |
68+
npx semantic-release
69+
70+
- name: Get release for editing
71+
id: get_release
72+
# version 1.2.4
73+
uses: cardinalby/git-get-release-action@5172c3a026600b1d459b117738c605fabc9e4e44
74+
env:
75+
GITHUB_TOKEN: ${{ github.token }}
76+
with:
77+
tag: ${{ env.VERSION_TAG }}
78+
79+
- name: Edit Release
80+
# version 1.2.0
81+
uses: irongut/EditRelease@ccf529ad26dddf9996e7dd0f24ca5da4ea507cc2
82+
with:
83+
token: ${{ secrets.GITHUB_TOKEN }}
84+
id: ${{ steps.get_release.outputs.id }}
85+
body: |
86+
## Info
87+
[See code diff](${{ github.event.compare }})
88+
[Release workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
89+
90+
It was initialized by [${{ github.event.sender.login }}](${{ github.event.sender.html_url }})

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.log
2+
**/node_modules/
3+
.envrc
4+
.idea
5+
.vscode/settings.json
6+
.DS_Store
7+
release_notes
8+
.venv
9+
.asdf

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.18.0

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.PHONY: install
2+
3+
install: install-node
4+
5+
install-node:
6+
npm ci
7+
8+
deep-clean:
9+
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

0 commit comments

Comments
 (0)