-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3419 from Turbo87/github-deploy
Use `actions/deploy-pages` to deploy `mdbook` output
- Loading branch information
Showing
1 changed file
with
21 additions
and
14 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
- master | ||
|
||
jobs: | ||
deploy: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -19,16 +19,23 @@ jobs: | |
- name: Generate Book | ||
run: | | ||
./generate-book.py | ||
- name: Deploy GitHub Pages | ||
run: | | ||
git worktree add gh-pages gh-pages | ||
git config user.name "Deploy from CI" | ||
git config user.email "" | ||
cd gh-pages | ||
# Delete the ref to avoid keeping history. | ||
git update-ref -d refs/heads/gh-pages | ||
rm -rf * | ||
mv ../book/* . | ||
git add . | ||
git commit -m "Deploy $GITHUB_SHA to gh-pages" | ||
git push --force | ||
- name: Upload Artifact | ||
uses: actions/[email protected] | ||
with: | ||
path: ./book | ||
|
||
deploy: | ||
needs: build | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- id: deployment | ||
uses: actions/[email protected] |