mailpot/.github/workflows/rustdoc.yml

101 lines
2.8 KiB
YAML

name: Build rustdoc for Github Pages
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
SQLITE_BIN: /home/runner/.sqlite3/sqlite3
on:
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- id: cache-sqlite3-bin
name: Cache sqlite3 binary
uses: actions/cache@v3
with:
path: /home/runner/.sqlite3
key: toolchain-sqlite3
- if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }}
name: Download sqlite3 binary
run: |
set -ex
sudo apt-get install -y --quiet wget unzip
mkdir -p /home/runner/.sqlite3
cd /home/runner/.sqlite3
wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip"
unzip sqlite-tools-linux-x86-3420000.zip
mv sqlite-tools-linux-x86-3420000/* .
rm -rf sqlite-tools-linux-x86-3420000*
echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV
- id: cache-rustup
name: Cache Rust toolchain
uses: actions/cache@v3
with:
path: ~/.rustup
key: toolchain-grcov
- id: cache-cargo
name: Cache Cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-grcov
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Make rustdocs
run: |
make rustdoc-nightly || make rustdoc
rm -rf docs
ls -R
mv target/doc docs
- name: Upload report artifacts
uses: actions/upload-artifact@v3
with:
name: docs
path: docs
deploy-docs:
needs: build-docs
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/checkout@v3
with:
ref: 'gh-pages'
token: ${{ secrets.GRCOVGHPAGES }}
- name: Download docs
id: download
uses: actions/download-artifact@v3
with:
name: docs
path: docs
- name: 'Echo download path'
run: echo ${{steps.download.outputs.download-path}}
- name: Display structure of downloaded files
run: ls -R
- name: Push
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git show-ref
git add docs
git commit -m "Update rustdoc"
git show-ref
git branch --verbose
git remote set-url origin "https://${{github.actor}}:${{ secrets.GRCOVGHPAGES }}@github.com/${{github.repository}}.git"
git push