Arc-Lang: Version 1 #575
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: GitHub pages | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
env: | |
ZOLA_VERSION: 0.16.1 | |
MDBOOK_LINKCHECK_VERSION: 0.7.6 | |
MDBOOK_BIB_VERSION: 0.0.4 | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Update apt index | |
run: sudo apt-get update | |
# ---- cargo ---- | |
- name: Install Cargo nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Cache mdbook-arc-lang | |
id: cache-mdbook-arc-lang | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/mdbook-arc-lang | |
key: ${{ runner.os }}-${{ hashFiles('arc-lang/crates/book/mdbook-arc-lang/**') }} | |
- name: Cache mdbook-grammar | |
id: cache-mdbook-grammar | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/mdbook-grammar | |
key: ${{ runner.os }}-${{ hashFiles('arc-lang/crates/book/mdbook-grammar/**') }} | |
- name: Cache mdbook-exec | |
id: cache-mdbook-exec | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/mdbook-exec | |
key: ${{ runner.os }}-${{ hashFiles('arc-lang/crates/book/mdbook-exec/**') }} | |
- name: Cache mdbook-bib | |
id: cache-mdbook-bib | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/mdbook-bib | |
key: ${{ runner.os }}-${{ env.MDBOOK_BIB_VERSION }} | |
- name: Cache mdbook-linkcheck | |
id: cache-mdbook-linkcheck | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/mdbook-linkcheck | |
key: ${{ runner.os }}-${{ env.MDBOOK_LINKCHECK_VERSION }} | |
- name: Cache zola | |
id: cache-zola | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/zola | |
key: ${{ runner.os }}-${{ env.ZOLA_VERSION }} | |
- name: Build mdbook-arc-lang | |
if: steps.cache-mdbook-arc-lang.outputs.cache-hit != 'true' | |
run: cargo install --path arc-lang/crates/book/mdbook-arc-lang | |
- name: Build mdbook-grammar | |
if: steps.cache-mdbook-grammar.outputs.cache-hit != 'true' | |
run: cargo install --path arc-lang/crates/book/mdbook-grammar | |
- name: Build mdbook-exec | |
if: steps.cache-mdbook-exec.outputs.cache-hit != 'true' | |
run: cargo install --path arc-lang/crates/book/mdbook-exec | |
- name: Build mdbook-bib | |
if: steps.cache-mdbook-bib.outputs.cache-hit != 'true' | |
run: cargo install mdbook-bib --version=${{ env.MDBOOK_BIB_VERSION }} --features="log/max_level_warn" | |
- name: Build mdbook-linkcheck | |
if: steps.cache-mdbook-linkcheck.outputs.cache-hit != 'true' | |
run: cargo install mdbook-linkcheck --version=${{ env.MDBOOK_LINKCHECK_VERSION }} | |
- name: Build zola | |
if: steps.cache-zola.outputs.cache-hit != 'true' | |
run: cargo install --git https://github.com/getzola/zola.git \ | |
--rev ad6c83412391dd748d4a9d8f3a0568687e73a447 \ | |
--version=${{ env.ZOLA_VERSION }} | |
# ---- website ---- | |
- name: Move book to website | |
run: | | |
mkdir -p arc-lang/crates/website/zola/static | |
mv arc-lang/target/mdbook/target/html arc-lang/crates/website/zola/static/book | |
- name: Update website theme submodule | |
run: | | |
git submodule update --init arc-lang/crates/website/zola/themes/adidoks | |
mkdir -p arc-lang/crates/website/zola/templates | |
cp arc-lang/crates/website/zola/themes/adidoks/templates/blog/page.html \ | |
arc-lang/crates/website/zola/templates/blog.html | |
- name: Build website | |
run: cargo run --manifest-path arc-lang/Cargo.toml --package=website | |
- name: Deploy to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: | | |
success() && | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
publish_dir: arc-lang/target/website | |
force_orphan: true |