Skip to content

Commit

Permalink
ci: use actions/deploy-pages instead of pushing to gh-pages branches
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed May 19, 2024
1 parent 3fa4218 commit 316760b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
rust: nightly
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- run: bash ci/install-rust.sh ${{ matrix.rust }}
- uses: SublimeText/UnitTesting/actions/setup@v1
with:
Expand Down
36 changes: 19 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@ on:
- master

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.11/mdbook-v0.4.11-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy docs
run: |
cd docs
mdbook build
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: Build book
run: cd docs && mdbook build
- name: Upload page artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/book
retention-days: 1

deploy:
permissions:
pages: write
id-token: write
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4

0 comments on commit 316760b

Please sign in to comment.