forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 1
211 lines (178 loc) · 7.11 KB
/
release-please.yml
File metadata and controls
211 lines (178 loc) · 7.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: release-please
on:
push:
branches:
- "v[0-9]*"
- master
permissions:
contents: write
pull-requests: write
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
release-please:
name: Create Release
runs-on: ubuntu-latest
outputs:
release-pr: ${{ steps.release.outputs.pr }}
release-version: ${{ steps.release.outputs.tag_name }}
steps:
- name: Run Release Please
id: release
uses: googleapis/release-please-action@7d28262f14160787a44a6be36146a18e6f575a3f
with:
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
config-file: .github/release-please-${{ github.ref_name }}.json
target-branch: ${{ github.ref_name }}
auto-tag:
needs: [release-please]
if: ${{ startsWith(github.ref, 'refs/heads/v') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com
- name: Extract version from branch name
id: version
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
MAJOR_VERSION="${BRANCH_NAME#v}"
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "major=$MAJOR_VERSION" >> $GITHUB_OUTPUT
- name: Determine next version
id: next_version
run: |
# Read current version from release-please manifest and use it directly
if [ ! -f .release-please-manifest.json ]; then
echo "Error: .release-please-manifest.json not found"
exit 1
fi
MANIFEST_VERSION=$(jq -r '."."' .release-please-manifest.json)
echo "Manifest version: $MANIFEST_VERSION"
# Ensure manifest major matches vX branch major
BRANCH_MAJOR="${{ steps.version.outputs.major }}"
if [ -z "$BRANCH_MAJOR" ]; then
echo "Error: Branch major version not available from previous step"
exit 1
fi
MANIFEST_MAJOR="${MANIFEST_VERSION%%.*}"
if [ "$MANIFEST_MAJOR" != "$BRANCH_MAJOR" ]; then
echo "Error: Manifest major ($MANIFEST_MAJOR) does not match branch major ($BRANCH_MAJOR)"
exit 1
fi
if [[ "$MANIFEST_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
NEXT_VERSION="$MANIFEST_VERSION"
else
echo "Error: Invalid manifest version format"
exit 1
fi
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo "Next version will be: $NEXT_VERSION"
- name: Get next RC number
id: rc
run: |
# Get all existing RC tags for this specific version
EXISTING_TAGS=$(git tag -l "v${{ steps.next_version.outputs.version }}-rc.*" | sort -V)
if [ -z "$EXISTING_TAGS" ]; then
# No RC tags exist yet for this version, start with 1
NEXT_RC=1
else
# Extract the highest RC number and increment
LAST_TAG=$(echo "$EXISTING_TAGS" | tail -n 1)
LAST_RC=$(echo "$LAST_TAG" | sed 's/.*-rc\.\([0-9]\+\)$/\1/')
NEXT_RC=$((LAST_RC + 1))
fi
echo "number=$NEXT_RC" >> $GITHUB_OUTPUT
echo "Next RC number: $NEXT_RC"
- name: Check if commit already tagged
id: check_tag
run: |
# Check if current commit already has any RC tag
EXISTING_TAGS=$(git tag --points-at HEAD | grep "^v.*-rc\." || true)
if [ -n "$EXISTING_TAGS" ]; then
echo "Commit already tagged as: $EXISTING_TAGS"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Create and push new RC tag
if: steps.check_tag.outputs.skip != 'true'
run: |
TAG_NAME="v${{ steps.next_version.outputs.version }}-rc.${{ steps.rc.outputs.number }}"
# Create annotated tag
git tag -a "$TAG_NAME" -m "Release candidate ${{ steps.rc.outputs.number }} for v${{ steps.next_version.outputs.version }}"
git push origin "$TAG_NAME"
echo "✅ Created tag: $TAG_NAME"
update-docs:
name: Update docs
env:
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
needs: [release-please]
if: ${{ needs.release-please.outputs.release-pr }}
runs-on: ubuntu-latest
steps:
- name: Checkout release branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Setup dependencies
run: |
sudo apt install -y --no-install-recommends doxygen
corepack enable
- name: Configure Git
run: |
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com
- name: Query new version
id: version
run: |
# Extract version from .release-please-manifest.json
AZTEC_VERSION=$(jq -r '."."' .release-please-manifest.json)
# Add v prefix
AZTEC_VERSION="v$AZTEC_VERSION"
echo "semver=$AZTEC_VERSION" >> $GITHUB_OUTPUT
- name: Cut Aztec Docs version
working-directory: ./docs
run: |
COMMIT_TAG=${{ steps.version.outputs.semver }}
# need to specify at least one version in versions.json for it to build
echo "[ \"$(./scripts/get_current_version.sh)\" ]" > versions.json
yarn
COMMIT_TAG=$COMMIT_TAG yarn build
COMMIT_TAG=$COMMIT_TAG yarn docusaurus docs:version ${{ steps.version.outputs.semver }}
- name: Update Aztec Docs versions.json with new version
working-directory: ./docs/scripts
run: |
./update_versions.sh
- name: Commit new Aztec Docs version
run: |
git add .
git commit -m "chore(docs): cut new aztec docs version for tag ${{ steps.version.outputs.semver }}"
git push
- name: Cut Barretenberg Docs version
working-directory: ./barretenberg/docs
run: |
COMMIT_TAG=${{ steps.version.outputs.semver }}
# need to specify at least one version in versions.json for it to build
echo "[ \"$(./scripts/get_current_version.sh)\" ]" > versions.json
yarn
COMMIT_TAG=$COMMIT_TAG yarn build
COMMIT_TAG=$COMMIT_TAG yarn docusaurus docs:version ${{ steps.version.outputs.semver }}
- name: Update Barretenberg Docs versions.json with new version
working-directory: ./barretenberg/docs/scripts
run: |
./update_versions.sh
- name: Commit new Barretenberg Docs version
run: |
git add .
git commit -m "chore(docs): cut new barretenberg docs version for tag ${{ steps.version.outputs.semver }}"
git push