Skip to content

Commit d764948

Browse files
committed
chore: add workflow to create canary release
1 parent 39a5fc4 commit d764948

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Canary Release Tag
2+
3+
on:
4+
workflow_dispatch:
5+
6+
# Add permissions for the GitHub Actions bot to push tags
7+
permissions:
8+
contents: write
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
13+
jobs:
14+
nightly-release-tag:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Check out the repository so we can read files and create tags.
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
19+
with:
20+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
21+
22+
# Extract the current release version from the manifest.
23+
# Then, create a canary tag using the current version and the current UTC date.
24+
- name: Create Canary Tag
25+
run: |
26+
git config --global user.email "[email protected]"
27+
git config --global user.name "AztecBot"
28+
current_version=$(jq -r '."."' .release-please-manifest.json)
29+
# Compute the next major version. e.g. if current version is 1.2.3, next major version is 2.0.0.
30+
if [[ "$current_version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
31+
major=$(( ${BASH_REMATCH[1]} + 1 ))
32+
next_major_version="${major}.0.0"
33+
else
34+
echo "Error: Current version format is invalid: $current_version"
35+
exit 1
36+
fi
37+
echo "Current version: $current_version"
38+
echo "Next version: $next_major_version"
39+
canary_tag="v${next_major_version}-canary.$(git rev-parse --short HEAD)"
40+
echo "Canary tag: $canary_tag"
41+
# Tag and push.
42+
git tag -a "$canary_tag" -m "$canary_tag"
43+
git push origin "$canary_tag"

0 commit comments

Comments
 (0)