Skip to content

Commit

Permalink
Deploy docs using actions instead of a gh-pages branch
Browse files Browse the repository at this point in the history
  • Loading branch information
idanarye committed Apr 18, 2024
1 parent e64fa2c commit fa9beba
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ on:
pull_request:
push:
branches: [master]

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

jobs:
ci:
name: CI
Expand Down Expand Up @@ -117,12 +125,24 @@ jobs:
sudo apt-get update
sudo apt-get install libgtk-4-dev
- name: Build docs
env:
GITHUB_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
cargo doc --verbose &&
echo "<meta http-equiv=refresh content=0;url=woab/index.html>" > target/doc/index.html &&
pip install ghp-import --user && export PATH=$HOME/.local/bin:$PATH &&
ghp-import -n target/doc &&
git push -fq https://${GITHUB_TOKEN}@github.com/${GITHUB_REPO}.git gh-pages
echo "<meta http-equiv=refresh content=0;url=woab/index.html>" > target/doc/index.html
- name: Add read permissions
run: |-
chmod --recursive +r target/doc
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: target/doc
deploy-ghpages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: docs-and-demos-ghpages
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit fa9beba

Please sign in to comment.