Skip to content

ci: set up GHA

ci: set up GHA #1

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main
pull_request:
jobs:
build_and_upload:
name: Build pages and upload
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.40'
- name: Build website
run: mdbook build
- name: Upload pages artifacts (Main branch)
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
with:
path: './book/'
name: 'gh-pages-${{github.sha}}'
- name: Upload pages artifacts (PR)
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/upload-artifact@v4
with:
path: './book/'
name: 'pages-${{github.sha}}'
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
concurrency:
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
needs: build_and_upload
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
with:
artifact_name: 'gh-pages-${{github.sha}}'