From 0dbb76af19b6e1c658c8aa369c89809d262335f0 Mon Sep 17 00:00:00 2001 From: Tim Vilgot Mikael Fredenberg <26655508+vilgotf@users.noreply.github.com> Date: Sun, 8 Sep 2024 13:07:35 +0200 Subject: [PATCH] ci: switch API docs to modern GH Pages action (#2194) Switch the GH Pages API documentation workflow from deploying from a commit to deploying from an artifact. Twilight currently has an extremely large `gh-pages` branch with all snapshots of our rustdoc rendered documentation for all crates as commits. Due to the nature of how Git stores commits, this ballons the branch's size (>200 MB!) and subsequently the whole repository's size. GitHub has since last year offered publishing to Pages from an uploaded artifact as an alternative to publishing from a branch which avoids storing the contents in Git. Additionally, this renames the API documentation environment from "github-pages" to "api-documentation" which should make it more discoverable to new users. --- .github/workflows/deploy-lib.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-lib.yml b/.github/workflows/deploy-lib.yml index a5f0b9097fa..d26891ad1bb 100644 --- a/.github/workflows/deploy-lib.yml +++ b/.github/workflows/deploy-lib.yml @@ -1,6 +1,7 @@ name: Deploy documentation on: + workflow_dispatch: push: branches: - main @@ -9,8 +10,18 @@ on: - "twilight*/**" - "Cargo.toml" +permissions: + contents: read + pages: write + id-token: write + +concurrency: "pages" + jobs: deploy-docs: + environment: + name: api-documentation + url: ${{ steps.deployment.outputs.page_url }} name: Deploy docs to gh-pages runs-on: ubuntu-latest @@ -37,13 +48,14 @@ jobs: run: | echo '' > target/doc/index.html - - name: Deploy docs - uses: peaceiris/actions-gh-pages@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY_BOT }} - publish_branch: gh-pages - publish_dir: target/doc - allow_empty_commit: true - cname: api.twilight.rs - user_name: "github-actions[bot]" - user_email: "github-actions[bot]@users.noreply.github.com" + path: target/doc + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4