@@ -104,15 +104,83 @@ jobs:
104104 # TODO: add job for publish package to Conda
105105 # https://github.com/apify/crawlee-python/issues/104
106106
107+ version_docs :
108+ name : Version docs
109+ needs : [release_prepare, changelog_update, pypi_publish]
110+ runs-on : ubuntu-latest
111+ outputs :
112+ version_docs_commitish : ${{ steps.commit_versioned_docs.outputs.commit_long_sha }}
113+ permissions :
114+ contents : write
115+ env :
116+ NODE_VERSION : 22
117+ PYTHON_VERSION : 3.14
118+
119+ steps :
120+ - name : Checkout repository
121+ uses : actions/checkout@v6
122+ with :
123+ token : ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
124+ ref : ${{ needs.changelog_update.outputs.changelog_commitish }}
125+
126+ - name : Set up Node
127+ uses : actions/setup-node@v6
128+ with :
129+ node-version : ${{ env.NODE_VERSION }}
130+
131+ - name : Set up Python
132+ uses : actions/setup-python@v6
133+ with :
134+ python-version : ${{ env.PYTHON_VERSION }}
135+
136+ - name : Set up uv package manager
137+ uses : astral-sh/setup-uv@v7
138+ with :
139+ python-version : ${{ env.PYTHON_VERSION }}
140+
141+ - name : Install Python dependencies
142+ run : uv run poe install-dev
143+
144+ - name : Install website dependencies
145+ run : |
146+ cd website
147+ corepack enable
148+ yarn install
149+
150+ - name : Snapshot the current version
151+ run : |
152+ cd website
153+ VERSION="$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('../pyproject.toml').read_text())['project']['version'])")"
154+ MAJOR_MINOR="$(echo "$VERSION" | cut -d. -f1-2)"
155+ export MAJOR_MINOR
156+ # Remove existing version if present (patch releases override)
157+ rm -rf "versioned_docs/version-${MAJOR_MINOR}"
158+ rm -rf "versioned_sidebars/version-${MAJOR_MINOR}-sidebars.json"
159+ jq 'map(select(. != env.MAJOR_MINOR))' versions.json > tmp.json && mv tmp.json versions.json
160+ # Copy changelog
161+ cp ../CHANGELOG.md ../docs/changelog.md
162+ # Build API reference and create version snapshots
163+ bash build_api_reference.sh
164+ npx docusaurus docs:version "$MAJOR_MINOR"
165+ npx docusaurus api:version "$MAJOR_MINOR"
166+
167+ - name : Commit and push versioned docs
168+ id : commit_versioned_docs
169+ uses : EndBug/add-and-commit@v10
170+ with :
171+ add : " website/versioned_docs website/versioned_sidebars website/versions.json"
172+ message : " docs: version ${{ needs.release_prepare.outputs.version_number }} docs [skip ci]"
173+ default_author : github_actions
174+
107175 doc_release :
108176 name : Doc release
109- needs : [changelog_update, pypi_publish]
177+ needs : [changelog_update, pypi_publish, version_docs ]
110178 permissions :
111179 contents : write
112180 pages : write
113181 id-token : write
114182 uses : ./.github/workflows/_release_docs.yaml
115183 with :
116- # Use the ref from the changelog update to include the updated changelog.
117- ref : ${{ needs.changelog_update .outputs.changelog_commitish }}
184+ # Use the version_docs commit to include both changelog and versioned docs .
185+ ref : ${{ needs.version_docs .outputs.version_docs_commitish }}
118186 secrets : inherit
0 commit comments