GHA pipeline rewrite for ease and speed #2420
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
name: Rustdoc | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
docs: | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest-4-cores | |
env: | |
RUSTDOCFLAGS: "-D warnings" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4 | |
- name: Prep build on Ubuntu | |
uses: ./.github/actions/prep-ubuntu | |
with: | |
RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }} | |
cache: enabled | |
# Cache needs Google credentials: | |
GWIP: ${{ secrets.GWIP_SCCACHE }} | |
GSA: ${{ secrets.GSA_SCCACHE }} | |
- name: Build documentation | |
id: build_docs | |
run: cargo doc --all --no-deps | |
- name: Build Documentation failed | |
if: always() && steps.build_docs.outcome == 'failure' | |
run: echo ":::error::cargo doc --all --no-deps failed" | |
# Job will stop here and the check will be red if Build documentation failed | |
- name: Create Index file | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "<meta http-equiv=\"refresh\" content=\"0; url=centrifuge_chain/index.html\">" \ > ./target/doc/index.html | |
- name: Deploy Docs | |
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # 3.9.3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ./target/doc | |
cname: reference.centrifuge.io | |
force_orphan: true |