.github/workflows/main.yml #109
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
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Set vars for build only if not on main" | |
run: | | |
echo "PAGES_BRANCH=test-pages" >> $GITHUB_ENV | |
if: github.ref != 'refs/heads/main' | |
- name: "Set vars for deploy if on main" | |
run: | | |
echo "PAGES_BRANCH=gh-pages" >> $GITHUB_ENV | |
if: github.ref == 'refs/heads/main' | |
- name: 'Install cargo' | |
run: sudo apt-get install -qy cargo | |
- name: "Cache cargo" | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: cargo | |
- name: 'Install mdbook' | |
run: cargo install --locked mdbook mdbook-admonish mdbook-tabs mdbook-svgbob | |
- name: 'Checkout' | |
uses: actions/checkout@master | |
- name: 'Checkout acton repo' | |
uses: actions/checkout@master | |
with: | |
repository: 'actonlang/acton' | |
path: 'acton' | |
token: ${{ secrets.ACTBOT_PAT }} | |
- name: 'Build acton-by-example' | |
run: | | |
export PATH=/.cargo/bin:$PATH | |
cd acton/docs/acton-by-example | |
mdbook build -d ../../../static/learn/acton-by-example | |
- name: 'Build and deploy' | |
uses: shalzz/zola-deploy-action@master | |
env: | |
BUILD_DIR: . | |
TOKEN: ${{ secrets.ACTBOT_PAT }} | |
PAGES_BRANCH: ${{ env.PAGES_BRANCH }} |