merge(#52): from aruZeta/release/3.1.0 #105
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: Gen Docs | |
on: | |
push: | |
branches: [ main, develop ] | |
tags: v* | |
paths: | |
- '**.nim*' | |
- '**.cfg' | |
- '.github/workflows/**' | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch repo's pushed branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
path: source | |
- name: Fetch repos's docs branch | |
uses: actions/checkout@v3 | |
with: | |
ref: docs | |
path: destination | |
- name: Install nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-22.05 | |
- name: Setup cachix | |
uses: cachix/cachix-action@v12 | |
with: | |
name: my-dotfiles # Holds the cached flake, so not to build it | |
- name: Build docs | |
run: | | |
cd source | |
nix shell -c nimble install pixie -y | |
nix shell -c nimble gendocs ${{ github.ref_name }} | |
cd .. | |
- name: Move docs to destination | |
run: | | |
nix shell nixpkgs#rsync -c \ | |
rsync -a --force source/docs/ destination/${{ github.ref_name }} | |
- name: Push docs | |
run: | | |
cd destination | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
git commit -m "[workflow] Generated ${{ github.ref_name }} docs" | |
git push |