From 02701e7770db7f774628702d38986d4097bb3bbb Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Tue, 21 Nov 2023 12:31:22 -0500 Subject: [PATCH 1/5] Add write permissions to token for pages --- .github/workflows/docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ada5f27..755e768 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,8 @@ jobs: publish: runs-on: ubuntu-latest container: devkitpro/devkitarm + permissions: + id-token: write steps: - name: Checkout branch uses: actions/checkout@v4 From ce3c8a05086c9eb3136193718fb569fdcec055eb Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Tue, 21 Nov 2023 12:38:31 -0500 Subject: [PATCH 2/5] Use a separate deploy job for github pages --- .github/workflows/docs.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 755e768..a33ac8b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,11 +7,9 @@ on: workflow_dispatch: jobs: - publish: + build: runs-on: ubuntu-latest container: devkitpro/devkitarm - permissions: - id-token: write steps: - name: Checkout branch uses: actions/checkout@v4 @@ -27,7 +25,13 @@ jobs: uses: actions/upload-pages-artifact@v2 with: path: ./target/armv6k-nintendo-3ds/doc - - - name: Deploy GitHub pages + deploy: + runs-on: ubuntu-latest + needs: build + permissions: + pages: write + id-token: write + steps: + - name: Deploy to GitHub Pages uses: actions/deploy-pages@v2 From 1216a78ea7435848146d3e881d0da14c20a75c5d Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Tue, 21 Nov 2023 12:45:37 -0500 Subject: [PATCH 3/5] Try specifying an environment --- .github/workflows/docs.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a33ac8b..c45068a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: docs +name: GitHub Pages on: push: @@ -31,7 +31,13 @@ jobs: permissions: pages: write id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: - name: Deploy to GitHub Pages + id: deployment uses: actions/deploy-pages@v2 From ba1d3571484c3a15a9f3cc5bb09feb7ba808863b Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Wed, 22 Nov 2023 11:47:50 -0500 Subject: [PATCH 4/5] Fix file permissions before upload --- .github/workflows/docs.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c45068a..738dc25 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,10 +21,18 @@ jobs: - name: Build workspace docs run: cargo 3ds --verbose doc --verbose --no-deps --workspace + # https://github.com/actions/upload-pages-artifact#file-permissions + - name: Fix file permissions + run: | + chmod -c -R +rX "target/armv6k-nintendo-3ds/doc" | while read line; do + echo "::warning title=Invalid file permissions automatically fixed::$line" + done + - name: Upload generated docs uses: actions/upload-pages-artifact@v2 with: path: ./target/armv6k-nintendo-3ds/doc + deploy: runs-on: ubuntu-latest needs: build From e9464fe0bc114433f7fa980d6a0bc187689c29bf Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Wed, 22 Nov 2023 12:36:14 -0500 Subject: [PATCH 5/5] Add default landing page for Pages --- .github/workflows/docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 738dc25..dc1c57e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,6 +20,10 @@ jobs: - name: Build workspace docs run: cargo 3ds --verbose doc --verbose --no-deps --workspace + env: + # TODO: might want a custom index page ? + # https://doc.rust-lang.org/rustdoc/unstable-features.html#--index-page-provide-a-top-level-landing-page-for-docs + RUSTDOCFLAGS: "--enable-index-page" # https://github.com/actions/upload-pages-artifact#file-permissions - name: Fix file permissions