-
Notifications
You must be signed in to change notification settings - Fork 596
306 lines (263 loc) · 11.2 KB
/
release-please.yml
File metadata and controls
306 lines (263 loc) · 11.2 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
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 }}
dedupe-release-notes:
name: Deduplicate release notes
needs: [release-please]
if: ${{ needs.release-please.outputs.release-pr }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Check if release notes branch exists
id: check-branch
env:
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
run: |
NOTES_BRANCH="${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}--release-notes"
if git ls-remote --exit-code "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" "refs/heads/$NOTES_BRANCH" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "branch=$NOTES_BRANCH" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Release notes branch $NOTES_BRANCH does not exist, skipping deduplication"
fi
- name: Checkout release notes branch
if: steps.check-branch.outputs.exists == 'true'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ steps.check-branch.outputs.branch }}
fetch-depth: 1
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Fetch dedupe script from target branch
if: steps.check-branch.outputs.exists == 'true'
run: |
git fetch origin ${{ github.ref_name }} --depth=1
git show origin/${{ github.ref_name }}:scripts/dedupe_release_notes.py > /tmp/dedupe_release_notes.py
- name: Configure Git
if: steps.check-branch.outputs.exists == 'true'
run: |
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com
- name: Deduplicate release notes
if: steps.check-branch.outputs.exists == 'true'
run: |
if [ -f release-notes.md ]; then
python3 /tmp/dedupe_release_notes.py release-notes.md
git add release-notes.md
if ! git diff --cached --quiet; then
git commit -m "chore: deduplicate release notes"
git push
fi
fi
- name: Update PR body with deduped notes
if: steps.check-branch.outputs.exists == 'true'
env:
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
run: |
if [ -f release-notes.md ]; then
PR_NUMBER=${{ fromJSON(needs.release-please.outputs.release-pr).number }}
NOTES_SIZE=$(wc -c < release-notes.md)
if [ "$NOTES_SIZE" -lt 60000 ]; then
gh pr edit "$PR_NUMBER" --body "$(cat release-notes.md)"
fi
fi
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: Install Noir toolchain
uses: noir-lang/noirup@v0.1.4
with:
toolchain: nightly
- 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: Generate Aztec.nr API documentation
working-directory: ./docs
run: |
./scripts/aztec_nr_docs_generation/generate_aztec_nr_docs.sh ${{ steps.version.outputs.semver }}
echo "Generated Aztec.nr API docs for: ${{ steps.version.outputs.semver }}"
- name: Build bb (uses cache if available)
working-directory: ./barretenberg/cpp
run: |
./bootstrap.sh build_native
echo "BB_PATH=$(pwd)/build/bin" >> $GITHUB_ENV
- name: Build noir packages
run: |
# Initialize noir submodule (required for yarn-project portal dependencies)
git submodule update --init --recursive noir/noir-repo
# Build noir JS packages (creates noir/packages/ directory needed by yarn-project)
cd noir
./bootstrap.sh install_deps
./bootstrap.sh build_packages
- name: Build aztec CLI
id: build-cli
continue-on-error: true
working-directory: ./yarn-project
run: |
./bootstrap.sh
echo "AZTEC_CLI_PATH=$(pwd)/aztec/dest/bin" >> $GITHUB_ENV
- name: Generate TypeScript API documentation
if: steps.build-cli.outcome == 'success'
working-directory: ./docs
run: |
# Generate TypeScript API docs for this version (requires yarn-project to be built)
./scripts/typescript_api_generation/generate_ts_api_docs.sh ${{ steps.version.outputs.semver }}
echo "Generated TypeScript API docs for: ${{ steps.version.outputs.semver }}"
- name: Generate Aztec CLI documentation
id: aztec-cli-docs
if: steps.build-cli.outcome == 'success'
working-directory: ./docs
continue-on-error: true
run: |
# Add locally built binaries to PATH
export PATH="${BB_PATH}:${PATH}"
# Create wrapper for aztec CLI that runs the local build
mkdir -p /tmp/cli-bin
cat > /tmp/cli-bin/aztec << 'EOF'
#!/bin/bash
node "$AZTEC_CLI_PATH/index.js" "$@"
EOF
chmod +x /tmp/cli-bin/aztec
# Copy aztec-up from repo (it's a standalone bash script)
cp "$GITHUB_WORKSPACE/aztec-up/bin/aztec-up" /tmp/cli-bin/aztec-up
chmod +x /tmp/cli-bin/aztec-up
export PATH="/tmp/cli-bin:${PATH}"
# Generate Aztec CLI docs using locally built binaries
./scripts/cli_reference_generation/generate_all_cli_docs.sh --force current
echo "Generated Aztec CLI documentation for: ${{ steps.version.outputs.semver }}"
- name: Generate BB CLI documentation
id: bb-cli-docs
working-directory: ./barretenberg/docs
continue-on-error: true
run: |
# Add locally built bb to PATH
export PATH="${BB_PATH}:${PATH}"
# Generate BB CLI docs
./scripts/generate_bb_cli_docs.sh --force current
echo "Generated BB CLI documentation for: ${{ steps.version.outputs.semver }}"
- name: Comment on PR if CLI docs generation failed
if: steps.build-cli.outcome == 'failure' || steps.aztec-cli-docs.outcome == 'failure' || steps.bb-cli-docs.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
run: |
FAILED_DOCS=""
if [[ "${{ steps.build-cli.outcome }}" == "failure" ]]; then
FAILED_DOCS="yarn-project build (cache miss)"
fi
if [[ "${{ steps.aztec-cli-docs.outcome }}" == "failure" ]]; then
if [[ -n "$FAILED_DOCS" ]]; then
FAILED_DOCS="$FAILED_DOCS, Aztec CLI"
else
FAILED_DOCS="Aztec CLI"
fi
fi
if [[ "${{ steps.bb-cli-docs.outcome }}" == "failure" ]]; then
if [[ -n "$FAILED_DOCS" ]]; then
FAILED_DOCS="$FAILED_DOCS, BB CLI"
else
FAILED_DOCS="BB CLI"
fi
fi
gh pr comment ${{ fromJSON(needs.release-please.outputs.release-pr).number }} --body "$(cat <<EOF
## CLI Documentation Generation Failed
The following CLI documentation failed to generate: $FAILED_DOCS
The release will continue, but CLI reference docs may be incomplete for this version.
cc @AztecProtocol/devrel
[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
EOF
)"
- name: Cut Aztec Developer Docs version
working-directory: ./docs
run: |
COMMIT_TAG=${{ steps.version.outputs.semver }}
yarn
COMMIT_TAG=$COMMIT_TAG yarn build
# Create versioned docs for Developer docs instance
COMMIT_TAG=$COMMIT_TAG yarn docusaurus docs:version:developer ${{ steps.version.outputs.semver }}
- name: Update Aztec Developer Docs versions with new version
working-directory: ./docs/scripts
run: |
./update_docs_versions.sh developer
- name: Cut Aztec Network Docs version
working-directory: ./docs
run: |
COMMIT_TAG=${{ steps.version.outputs.semver }}
# Create versioned docs for Network docs instance
COMMIT_TAG=$COMMIT_TAG yarn docusaurus docs:version:network ${{ steps.version.outputs.semver }}
- name: Update Aztec Network Docs versions with new version
working-directory: ./docs/scripts
run: |
./update_docs_versions.sh network
- name: Commit new Aztec Docs version
run: |
# Reset non-versioned CLI docs (only versioned copies should be committed)
git checkout -- docs/docs-developers/docs/cli/*_cli_reference.md || true
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