@@ -3,6 +3,7 @@ name: release-please
33on :
44 push :
55 branches :
6+ - " v[0-9]*"
67 - master
78
89permissions :
@@ -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 :
0 commit comments