Skip to content

Commit 110cd4f

Browse files
authored
feat: add release automation for v2 packages (#16681)
# Add release-please v2 configuration and release branch automation This PR introduces a new release management system for Aztec Packages v2: 1. Adds `.github/release-please-v2.json` configuration file with: - Simple release type settings - Custom changelog sections - PR title patterns and headers 2. Creates a new workflow for release branch management: - Adds `.github/workflows/create-release-branch.yml` to automate creating version branches - Workflow extracts current version from manifest and creates appropriate branch - Automatically increments major version in manifest after branch creation 3. Enhances the existing release-please workflow: - Adds support for version branches (`v[0-9]+`) - Implements automatic RC tag generation with incremental numbering - Prevents duplicate tagging of commits 4. Updates CI workflow to properly handle RC releases: - Modifies condition in `ci3.yml` to recognize `-rc.` tags in addition to `-nightly.` tags 5. Removes the obsolete `.github/actions/setup-k8s-terraform/action.yml` file
2 parents 3af8061 + 0d8e8b2 commit 110cd4f

File tree

6 files changed

+191
-159
lines changed

6 files changed

+191
-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: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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: Configure Git
31+
run: |
32+
git config --global user.name "AztecBot"
33+
git config --global user.email "[email protected]"
34+
35+
- name: Create release branch
36+
run: |
37+
# Get the version from the release-please-manifest.json file
38+
CURRENT_VERSION=$(jq -r '."."' .release-please-manifest.json)
39+
40+
# grab major version
41+
CURRENT_MAJOR_VERSION="${CURRENT_VERSION%%.*}"
42+
43+
# create branch name
44+
BRANCH_NAME="v${CURRENT_MAJOR_VERSION}"
45+
46+
# Check if branch already exists
47+
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
48+
echo "Error: Branch $BRANCH_NAME already exists"
49+
exit 1
50+
fi
51+
52+
# Create and push the branch
53+
git checkout -b "$BRANCH_NAME"
54+
git push origin "$BRANCH_NAME"
55+
56+
# increment major version
57+
NEXT_MAJOR_VERSION=$((CURRENT_MAJOR_VERSION + 1))
58+
NEXT_VERSION="${NEXT_MAJOR_VERSION}.0.0"
59+
60+
# update release-please-manifest.json on `next` branch
61+
git fetch origin next
62+
git checkout -B next origin/next
63+
jq --arg version "$NEXT_VERSION" '.["."] = $version' .release-please-manifest.json > temp.json && mv temp.json .release-please-manifest.json
64+
git add .release-please-manifest.json
65+
git commit -m "chore(release): update release-please-manifest.json to $NEXT_VERSION"
66+
git push origin next

.github/workflows/release-please.yml

Lines changed: 100 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,105 @@ jobs:
2728
config-file: .github/release-please-${{ github.ref_name }}.json
2829
target-branch: ${{ github.ref_name }}
2930

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