CIP-0129 support #11245
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: Publish Docs | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
docs: | |
runs-on: ubuntu-20.04 | |
env: | |
PUBLISH_DIR: _build | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
steps: | |
- name: "📥 Checkout repository" | |
uses: actions/[email protected] | |
- name: "❄ Install Nix" | |
uses: cachix/install-nix-action@v20 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.13.3/install | |
nix_path: nixpkgs=channel:nixos-22.11 | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://hydra.iohk.io https://cache.nixos.org/ | |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: adp | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: "🔧 Set versions" | |
id: versions | |
run: | | |
if [[ $GITHUB_REF =~ ^refs/tags/v ]]; then | |
tag="${GITHUB_REF/refs\/tags\//}" | |
commit_message="Release $tag" | |
else | |
tag="" | |
commit_message="$default_commit_message" | |
fi | |
# commit message can be multiline | |
echo 'commit_message<<EOF' >> $GITHUB_OUTPUT | |
echo $commit_message >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
env: | |
default_commit_message: | | |
docs: ${{ github.event.head_commit.message }} | |
Source commit: ${{ github.sha }} | |
- name: "❄ Install dependencies" | |
run: "nix develop .#docs --command mdbook --version" | |
- name: "📸 Build Documentation" | |
run: | | |
build_dir="$PUBLISH_DIR" | |
nix develop .#docs -c mdbook build -d "../../$build_dir" "docs/site" | |
ls -l "$build_dir" | |
./scripts/gh/update-docs.sh "$build_dir" ${{ steps.versions.outputs.tag }} | |
- name: "📘 Publish" | |
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.WILLIAM_KING_TOKEN }} | |
enable_jekyll: false | |
publish_dir: ${{ env.PUBLISH_DIR }} | |
keep_files: true | |
user_name: "Cardano Wallet Documentation Bot" | |
user_email: "[email protected]" | |
full_commit_message: ${{ steps.versions.outputs.commit_message }} |