Skip to content

Commit 0c6bbb2

Browse files
committed
mitch/tmnt-183-each-push-to-v2-bumps-the-rc-count
1 parent e0433ce commit 0c6bbb2

File tree

6 files changed

+171
-159
lines changed

6 files changed

+171
-159
lines changed

.github/actions/setup-k8s-terraform/action.yml

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

.github/release-please-v2.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "simple",
4+
"bump-minor-pre-major": true,
5+
"bump-patch-for-minor-pre-major": true,
6+
"group-pull-request-title-pattern": "chore(v2): Release ${version}",
7+
"pull-request-header": "Pending Aztec Packages v2 release",
8+
"versioning": "always-bump-patch",
9+
"include-component-in-tag": false,
10+
"changelog-sections": [
11+
{ "type": "feat", "section": "Features", "hidden": false },
12+
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
13+
{ "type": "chore", "section": "Miscellaneous", "hidden": false },
14+
{ "type": "test", "section": "Miscellaneous", "hidden": false },
15+
{ "type": "refactor", "section": "Miscellaneous", "hidden": false },
16+
{ "type": "docs", "section": "Documentation", "hidden": false }
17+
],
18+
"packages": {
19+
".": {
20+
"release-type": "simple"
21+
}
22+
}
23+
}

.github/workflows/ci3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
exec ./ci.sh docs
137137
elif [ "${CI_BARRETENBERG:-0}" -eq 1 ]; then
138138
exec ./ci.sh barretenberg
139-
elif [ "${{ contains(github.ref, '-nightly.') }}" == "true" ]; then
139+
elif [ "${{ contains(github.ref, '-nightly.') }}" == "true" ] || [ "${{ contains(github.ref, '-rc.') }}" == "true" ]; then
140140
exec ./ci.sh nightly
141141
elif [ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]; then
142142
exec ./ci.sh release
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Create Release Branch
2+
3+
# Take the current version from the release-please-manifest.json file on `next`,
4+
# and create a release branch for it. Then update the release-please-manifest.json file on `next` to the next version.
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
source_commit:
10+
description: "Source commit SHA from next branch"
11+
required: true
12+
type: string
13+
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
16+
17+
jobs:
18+
create-release-branch:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
25+
with:
26+
ref: ${{ github.event.inputs.source_commit }}
27+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
28+
fetch-depth: 0
29+
30+
- name: Create release branch
31+
run: |
32+
# Get the version from the release-please-manifest.json file
33+
CURRENT_VERSION=$(jq -r '."."' .release-please-manifest.json)
34+
35+
# grab major version
36+
CURRENT_MAJOR_VERSION="${CURRENT_VERSION%%.*}"
37+
38+
# create branch name
39+
BRANCH_NAME="v${CURRENT_MAJOR_VERSION}"
40+
41+
# Check if branch already exists
42+
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
43+
echo "Error: Branch $BRANCH_NAME already exists"
44+
exit 1
45+
fi
46+
47+
# Create and push the branch
48+
git checkout -b "$BRANCH_NAME"
49+
git push origin "$BRANCH_NAME"
50+
51+
# increment major version
52+
NEXT_MAJOR_VERSION=$((CURRENT_MAJOR_VERSION + 1))
53+
NEXT_VERSION="${NEXT_MAJOR_VERSION}.0.0"
54+
55+
# update release-please-manifest.json on `next` branch
56+
git checkout next
57+
git reset --hard HEAD
58+
jq --arg version "$NEXT_VERSION" '.["."] = $version' .release-please-manifest.json > temp.json && mv temp.json .release-please-manifest.json
59+
git add .release-please-manifest.json
60+
git commit -m "chore(release): update release-please-manifest.json to $NEXT_VERSION"
61+
git push origin "$BRANCH_NAME"

.github/workflows/release-please.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: release-please
33
on:
44
push:
55
branches:
6+
- "v[0-9]+"
67
- master
78

89
permissions:
@@ -27,6 +28,90 @@ jobs:
2728
config-file: .github/release-please-${{ github.ref_name }}.json
2829
target-branch: ${{ github.ref_name }}
2930

31+
auto-tag:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: write
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
38+
with:
39+
fetch-depth: 0
40+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
41+
42+
- name: Extract version from branch name
43+
id: version
44+
run: |
45+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
46+
MAJOR_VERSION="${BRANCH_NAME#v}"
47+
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
48+
echo "major=$MAJOR_VERSION" >> $GITHUB_OUTPUT
49+
50+
- name: Determine next version
51+
id: next_version
52+
run: |
53+
# Read current version from release-please manifest and use it directly
54+
if [ ! -f .release-please-manifest.json ]; then
55+
echo "Error: .release-please-manifest.json not found"
56+
exit 1
57+
fi
58+
59+
MANIFEST_VERSION=$(jq -r '."."' .release-please-manifest.json)
60+
echo "Manifest version: $MANIFEST_VERSION"
61+
62+
if [[ "$MANIFEST_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
63+
NEXT_VERSION="$MANIFEST_VERSION"
64+
else
65+
echo "Error: Invalid manifest version format"
66+
exit 1
67+
fi
68+
69+
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
70+
echo "Next version will be: $NEXT_VERSION"
71+
72+
- name: Get next RC number
73+
id: rc
74+
run: |
75+
# Get all existing RC tags for this specific version
76+
EXISTING_TAGS=$(git tag -l "v${{ steps.next_version.outputs.version }}-rc.*" | sort -V)
77+
78+
if [ -z "$EXISTING_TAGS" ]; then
79+
# No RC tags exist yet for this version, start with 1
80+
NEXT_RC=1
81+
else
82+
# Extract the highest RC number and increment
83+
LAST_TAG=$(echo "$EXISTING_TAGS" | tail -n 1)
84+
LAST_RC=$(echo "$LAST_TAG" | sed 's/.*rc\.\([0-9]*\).*/\1/')
85+
NEXT_RC=$((LAST_RC + 1))
86+
fi
87+
88+
echo "number=$NEXT_RC" >> $GITHUB_OUTPUT
89+
echo "Next RC number: $NEXT_RC"
90+
91+
- name: Check if commit already tagged
92+
id: check_tag
93+
run: |
94+
# Check if current commit already has any RC tag
95+
EXISTING_TAGS=$(git tag --points-at HEAD | grep "^v.*-rc\." || true)
96+
97+
if [ -n "$EXISTING_TAGS" ]; then
98+
echo "Commit already tagged as: $EXISTING_TAGS"
99+
echo "skip=true" >> $GITHUB_OUTPUT
100+
else
101+
echo "skip=false" >> $GITHUB_OUTPUT
102+
fi
103+
104+
- name: Create and push new RC tag
105+
if: steps.check_tag.outputs.skip != 'true'
106+
run: |
107+
TAG_NAME="v${{ steps.next_version.outputs.version }}-rc.${{ steps.rc.outputs.number }}"
108+
109+
# Create annotated tag
110+
git tag -a "$TAG_NAME" -m "Release candidate ${{ steps.rc.outputs.number }} for v${{ steps.next_version.outputs.version }}"
111+
git push origin "$TAG_NAME"
112+
113+
echo "✅ Created tag: $TAG_NAME"
114+
30115
update-docs:
31116
name: Update docs
32117
env:

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.2.1"
2+
".": "2.0.0"
33
}

0 commit comments

Comments
 (0)