wip refact working doc workflow #82
Workflow file for this run
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: Generate docs | |
on: | |
push: | |
branches: | |
- main | |
- ops/doc # for testing on feature branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
RUSTC_WRAPPER: sccache | |
CCACHE: sccache | |
SCCACHE_GHA_ENABLED: 'true' | |
LIBCLANG_PATH: /usr/lib/llvm-14/lib | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: Mozilla-Actions/[email protected] | |
- name: Configure cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Setup Nix Shell | |
uses: rrbutani/use-nix-shell-action@v1 | |
with: | |
file: shell.nix | |
- name: Clean docs folder | |
run: cargo clean --doc | |
- name: Build docs | |
run: cargo doc -p verso --no-deps | |
- name: Remove lock file | |
run: rm target/doc/.lock | |
- name: Upload `doc` | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doc | |
path: target/doc | |
deploy: | |
if: github.repository_owner == 'versotile-org' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout `docs` repository | |
uses: actions/checkout@v4 | |
with: | |
repository: versotile-org/docs.versotile.org | |
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }} | |
ref: docs | |
- name: Download `doc` | |
uses: actions/download-artifact@v4 | |
with: | |
name: doc | |
path: artifact | |
- name: Configure git, commit changes and PUSH | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
rm -r docs/* | |
mv ../artifact/* docs/ | |
git add docs/ | |
git fetch origin main:main | |
git checkout main docs/ | |
git status | |
git commit -m ":rocket: update docs from \`verso\` repository" | |
# git push origin docs |