66 workflow_dispatch :
77 push :
88 branches : [main]
9+ tags :
10+ - " v*"
911
1012permissions :
11- id-token : write
13+ id-token : write # needed for trusted publishing (OIDC) to npm and crates.io
1214 contents : write # needed to create a release
1315
1416jobs :
3032 runs-on : ubuntu-latest
3133 outputs :
3234 version : ${{ steps.set-version.outputs.version }}
35+ dry_run : ${{ steps.set-version.outputs.dry_run }}
3336
3437 steps :
3538 - uses : actions/checkout@v6
@@ -42,67 +45,50 @@ jobs:
4245 shell : bash
4346 run : |
4447 git fetch --tags || true
45- # Extract the version number from the branch name, which is expected to be in the format 'release/ vX.Y.Z'
48+ # Extract the version number from the tag name, which is expected to be in the format 'vX.Y.Z'
4649 # if not, default to '0.0.0' to avoid errors in subsequent steps
47- if [[ "${GITHUB_REF}" =~ refs/heads/release /v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
50+ if [[ "${GITHUB_REF}" =~ refs/tags /v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
4851 version="${BASH_REMATCH[1]}"
52+ dry_run=false
4953 else
5054 version="0.0.0"
55+ dry_run=true
5156 fi
5257 echo "Setting version to 'v$version'"
5358 echo "version=$version" >> $GITHUB_OUTPUT
59+ echo "dry_run=$dry_run" >> $GITHUB_OUTPUT
5460
55- create-gh- release :
61+ create-release-branch :
5662 needs : [build, benchmarks, set-version]
57- environment : release
5863 runs-on : ubuntu-latest
59- if : ${{ contains(github.ref, 'refs/heads/release/') }}
64+ if : ${{ needs.set-version.outputs.dry_run == 'false' }}
6065
6166 steps :
62- - name : Download benchmarks (Windows)
63- uses : actions/download-artifact@v8
64- with :
65- name : benchmarks_Windows_whp
66- path : benchmarks_Windows_whp
67-
68- - name : Download benchmarks (Linux kvm)
69- uses : actions/download-artifact@v8
70- with :
71- name : benchmarks_Linux_kvm
72- path : benchmarks_Linux_kvm
67+ - uses : actions/checkout@v6
7368
74- - name : Download benchmarks (Linux hyperv3)
75- uses : actions/download-artifact@v8
76- with :
77- name : benchmarks_Linux_hyperv3
78- path : benchmarks_Linux_hyperv3
79-
80- - name : Archive benchmarks
69+ - name : Create Release Branch
70+ shell : bash
8171 run : |
82- tar -zcvf benchmarks_Windows_whp.tar.gz benchmarks_Windows_whp
83- tar -zcvf benchmarks_Linux_kvm.tar.gz benchmarks_Linux_kvm
84- tar -zcvf benchmarks_Linux_hyperv3.tar.gz benchmarks_Linux_hyperv3
72+ git checkout -b release/v${{ needs.set-version.outputs.version }}
73+ git push --set-upstream origin release/v${{ needs.set-version.outputs.version }}
8574
86- - name : Create GH Release
87- run : |
88- gh release create ${{ needs.set-version.outputs.version }} \
89- --generate-notes \
90- benchmarks_Windows_whp.tar.gz \
91- benchmarks_Linux_kvm.tar.gz \
92- benchmarks_Linux_hyperv3.tar.gz
93- env :
94- GH_TOKEN : ${{ github.token }}
75+ publish-gh-release :
76+ needs : [build, benchmarks, set-version]
77+ uses : ./.github/workflows/gh-publish.yml
78+ with :
79+ version : ${{ needs.set-version.outputs.version }}
80+ dry_run : ${{ needs.set-version.outputs.dry_run != 'false' }}
9581
9682 publish-npm-packages :
9783 needs : [build, benchmarks, set-version]
9884 uses : ./.github/workflows/npm-publish.yml
9985 with :
10086 version : ${{ needs.set-version.outputs.version }}
101- dry-run : ${{ !contains(github.ref, 'refs/heads/release/') }}
87+ dry_run : ${{ needs.set-version.outputs.dry_run != 'false' }}
10288
10389 publish-cargo-crates :
10490 needs : [build, benchmarks, set-version]
10591 uses : ./.github/workflows/cargo-publish.yml
10692 with :
10793 version : ${{ needs.set-version.outputs.version }}
108- dry-run : ${{ !contains(github.ref, 'refs/heads/release/') }}
94+ dry_run : ${{ needs.set-version.outputs.dry_run != 'false' }}
0 commit comments