-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The workflow definition is modeled after that of loongson-community/areweloongyet.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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}}' |