From 6ce271596f7be01fa3cdbd02b66b8a9991730bfb Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Tue, 18 Aug 2026 20:20:49 +0200 Subject: [PATCH 1/2] deploy dev-guide to gh pages --- .github/workflows/ci.yml | 13 --------- .github/workflows/dev-guide.yml | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/dev-guide.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f9f34fb79..191d5a90a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,19 +101,6 @@ jobs: if: ${{ always() }} run: just compose-down-and-wipe - dev-guide: - name: dev-guide mdbook - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v7 - - - uses: taiki-e/install-action@v2 - with: - tool: just,mdbook,mdbook-linkcheck2 - - - run: just book-test - lint-format: name: linters & formatters runs-on: ubuntu-latest diff --git a/.github/workflows/dev-guide.yml b/.github/workflows/dev-guide.yml new file mode 100644 index 0000000000..cc22fb9fa3 --- /dev/null +++ b/.github/workflows/dev-guide.yml @@ -0,0 +1,47 @@ +name: Dev-Guide mdBook + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + name: build and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install Rust + run: rustup update stable && rustup default stable + + - name: Install mdbook + uses: taiki-e/install-action@v2 + with: + tool: just,mdbook,mdbook-linkcheck2 + + - run: + just book-test # also runs the build + + - uses: actions/upload-pages-artifact@v3 + with: + path: docs/book/html + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'rust-lang' + + # Deploy is run as a separate job as it needs elevated permissions + deploy: + name: deploy + needs: test # the `test` job uploads the pages artifact + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'rust-lang' + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 + id: deployment From b30f85ba0217a0fbc2c607aa886967a289e92e3c Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Tue, 18 Aug 2026 23:23:20 +0200 Subject: [PATCH 2/2] dev-guide deploy: only deploy on pull-request merge --- .github/workflows/dev-guide.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev-guide.yml b/.github/workflows/dev-guide.yml index cc22fb9fa3..11f2214865 100644 --- a/.github/workflows/dev-guide.yml +++ b/.github/workflows/dev-guide.yml @@ -1,14 +1,16 @@ name: Dev-Guide mdBook on: - push: + pull_request: + pull_request_target: branches: - main - pull_request: + types: [closed] jobs: test: name: build and test + if: ${{ github.event_name == 'pull_request' || github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -27,13 +29,12 @@ jobs: - uses: actions/upload-pages-artifact@v3 with: path: docs/book/html - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'rust-lang' # Deploy is run as a separate job as it needs elevated permissions deploy: name: deploy needs: test # the `test` job uploads the pages artifact - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'rust-lang' + if: github.event_name == 'pull_request_target' && github.event.pull_request.merged && github.repository_owner == 'rust-lang' permissions: pages: write id-token: write