Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy book from releases, not commits to main #261

Merged
merged 2 commits into from
Jan 22, 2024
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
45 changes: 1 addition & 44 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Book
name: Build book
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
branches:
Expand All @@ -12,21 +11,11 @@ on:
- .github/workflows/book.yml
- book/**

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: beta
- uses: Swatinem/rust-cache@v2
- name: Install mdbook and mdbook-linkcheck
uses: taiki-e/install-action@v2
with:
Expand All @@ -40,35 +29,3 @@ jobs:
with:
name: book
path: book/book

deploy:
if:
github.repository == 'sourcefrog/cargo-mutants' && github.ref_name ==
'main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency: # Allow one concurrent deployment
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
tool: mdbook, mdbook-linkcheck
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build book
run: |
mdbook build book
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "book/book/html"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
44 changes: 44 additions & 0 deletions .github/workflows/release-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Publish the book to https://mutants.rs/ when a new release is created.
name: Release book
on:
release:
types:
- published
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
if: github.repository == 'sourcefrog/cargo-mutants'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency: # Allow one concurrent deployment
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
tool: mdbook, mdbook-linkcheck
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build book
run: |
mdbook build book
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "book/book/html"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1