Skip to content

Commit d3bc9f2

Browse files
authored
ci(release): add documentation versioning to release workflow (#1120)
Automatically snapshots current documentation for each major.minor release to provide historical versions.
1 parent 6b2ac75 commit d3bc9f2

5 files changed

Lines changed: 17636 additions & 19804 deletions

File tree

.github/workflows/release.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ jobs:
239239
"tag": "latest"
240240
}
241241
242+
version_docs:
243+
name: Version docs
244+
needs: [update_changelog, publish_to_npm]
245+
uses: ./.github/workflows/version_docs.yaml
246+
secrets: inherit
247+
242248
update_homebrew_formula:
243249
name: Update Homebrew Formula
244250
needs: [update_changelog, publish_to_npm]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Version docs
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
version_docs:
9+
name: Version docs
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v6
15+
with:
16+
ref: ${{ github.event.repository.default_branch }}
17+
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version: 24
23+
24+
- name: Install pnpm and dependencies
25+
uses: apify/workflows/pnpm-install@main
26+
27+
- name: Snapshot the current version
28+
id: version
29+
run: |
30+
VERSION=$(jq -r '.version' package.json)
31+
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
cd website
34+
rm -rf versioned_docs/version-$MAJOR_MINOR
35+
rm -rf versioned_sidebars/version-$MAJOR_MINOR-sidebars.json
36+
jq --arg v "$MAJOR_MINOR" 'map(select(. != $v))' versions.json > tmp.json && mv tmp.json versions.json
37+
pnpm exec docusaurus docs:version $MAJOR_MINOR
38+
39+
- name: Format
40+
working-directory: website
41+
run: pnpm run prettify
42+
43+
- name: Commit and push the version snapshot
44+
uses: EndBug/add-and-commit@v10
45+
with:
46+
author_name: Apify Release Bot
47+
author_email: noreply@apify.com
48+
message: "docs: version docs for ${{ steps.version.outputs.version }} [skip ci]"
49+
pull: "--rebase --autostash"

0 commit comments

Comments
 (0)