Add versoview and versoview_messages (#199) #127
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-24.04 | |
permissions: | |
actions: write # for purging | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nixbuild/nix-quick-install-action@v28 | |
- name: "Restore and cache Nix store" | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
paths: | | |
~/.cargo | |
target/debug/ | |
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'Cargo.lock', 'Cargo.toml') }} | |
restore-prefixes-first-match: nix-${{ runner.os }}- | |
gc-max-store-size-linux: 1073741824 | |
- name: "Add Nix channel" | |
run: | | |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs | |
nix-channel --update nixpkgs | |
- name: "Build Verso docs" | |
run: nix-shell shell.nix --run 'cargo doc -p verso --no-deps' | |
- name: "Remove doc lock file" | |
run: rm target/doc/.lock | |
- name: "Upload `doc` artifact" | |
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/www-docs | |
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }} | |
ref: docs | |
- name: "Download `doc` artifact" | |
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/* | |
cp -r 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" || exit 0 | |
git push origin docs |