Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 67 additions & 17 deletions .github/workflows/manual_release_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ env:
PYTHON_VERSION: 3.14

jobs:
release_docs:
name: Release docs
environment:
name: github-pages
build_docs:
name: Build docs
permissions:
contents: write
pages: write
id-token: write
contents: read
checks: read
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}

steps:
# Gate manual dispatches on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`);
Expand All @@ -52,7 +50,11 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
persist-credentials: false

- name: Record the built commit
id: sha
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
Expand Down Expand Up @@ -81,28 +83,76 @@ jobs:
- name: Update docs theme
run: uv run poe update-docs-theme

- name: Commit the updated package.json and lockfile
uses: apify/actions/signed-commit@v1.6.2
- name: Upload the updated package.json and lockfile
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
message: "chore: Automatic docs theme update [skip ci]"
add: website/package.json website/pnpm-lock.yaml
pull: --rebase --autostash
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
name: docs-theme-update
path: |
website/package.json
website/pnpm-lock.yaml
retention-days: 1

- name: Build docs
run: uv run poe build-docs
env:
APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }}
SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }}

- name: Set up GitHub Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./website/build

# The service account token is only used in jobs that do not run the docs toolchain.
commit_docs_theme:
name: Commit docs theme update
needs: [build_docs]
permissions:
contents: read
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
persist-credentials: false

# Start from the commit the update was made on, so the pull below merges it with anything pushed since.
- name: Reset to the built commit
run: git reset --hard "$BUILT_SHA"
env:
BUILT_SHA: ${{ needs.build_docs.outputs.sha }}

- name: Download the updated package.json and lockfile
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: docs-theme-update
path: website

- name: Commit the updated package.json and lockfile
uses: apify/actions/signed-commit@v1.6.2
with:
message: "chore: Automatic docs theme update [skip ci]"
add: website/package.json website/pnpm-lock.yaml
pull: --rebase --autostash
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

deploy_docs:
name: Deploy docs
needs: [build_docs]
environment:
name: github-pages
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest

steps:
- name: Set up GitHub Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0

- name: Deploy artifact to GitHub Pages
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

Expand Down
54 changes: 51 additions & 3 deletions .github/workflows/manual_version_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ jobs:
name: Version docs
runs-on: ubuntu-latest
permissions:
contents: write
contents: read
checks: read
outputs:
sha: ${{ steps.sha.outputs.sha }}
version: ${{ steps.snapshot.outputs.version }}

steps:
# Gate manual dispatches on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`);
Expand All @@ -51,7 +54,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
persist-credentials: false

- name: Record the built commit
id: sha
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
Expand Down Expand Up @@ -123,10 +130,51 @@ jobs:
uv run pnpm exec docusaurus docs:version "$MAJOR_MINOR_VERSION"
uv run pnpm exec docusaurus api:version "$MAJOR_MINOR_VERSION"

- name: Upload versioned docs
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: versioned-docs
path: |
website/versioned_docs
website/versioned_sidebars
website/versions.json
include-hidden-files: true
retention-days: 1

# The service account token is only used in a job that does not run the docs toolchain.
commit_versioned_docs:
name: Commit versioned docs
needs: [version_docs]
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

# Start from the commit the snapshot was made on, so the pull below merges it with anything pushed since.
- name: Reset to the built commit
run: git reset --hard "$BUILT_SHA"
env:
BUILT_SHA: ${{ needs.version_docs.outputs.sha }}

- name: Remove the previous snapshot
run: rm -rf website/versioned_docs website/versioned_sidebars website/versions.json

- name: Download versioned docs
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: versioned-docs
path: website

- name: Commit and push versioned docs
uses: apify/actions/signed-commit@v1.6.2
with:
message: "docs: Version docs for v${{ steps.snapshot.outputs.version }} [skip ci]"
message: "docs: Version docs for v${{ needs.version_docs.outputs.version }} [skip ci]"
add: website/versioned_docs website/versioned_sidebars website/versions.json
pull: --rebase --autostash
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"lint:code:fix": "oxlint --type-aware --fix",
"format": "oxfmt",
"format:check": "oxfmt --check",
"opt:images": "pnx --config.onlyBuiltDependencies=* @343dev/optimizt --webp",
"preinstall": "npx only-allow pnpm"
"opt:images": "pnx --config.onlyBuiltDependencies=* @343dev/optimizt --webp"
},
"dependencies": {
"@apify/docs-theme": "^1.0.287",
Expand Down
Loading