Skip to content

Fix: Get zola url dynamically #26

Fix: Get zola url dynamically

Fix: Get zola url dynamically #26

Workflow file for this run

name: Build with Trunk and Deploy with GitHub Pages
on:
push:
branches:
# Run when we push to the `main` branch.
- main
# Run when we push to any branch that starts with `cicd/`
- 'cicd/**'
- 'internal/add_website'
# Run this workflow manually from the Actions tab.
workflow_dispatch:
## Run when we do a new GitHub release.
# release:
# types:
# - published
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build-github-pages:
environment:
name: Build with Trunk and Deploy with GitHub's "static" Starter Workflow
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download and Install Zola Binary
run: |
LATEST_ZOLA=$(curl -s https://api.github.com/repos/getzola/zola/releases/latest | jq -r '.tag_name')
wget -q https://github.com/getzola/zola/releases/download/${LATEST_ZOLA}/zola-${LATEST_ZOLA}-x86_64-unknown-linux-gnu.tar.gz
tar -xzf zola-${LATEST_ZOLA}-x86_64-unknown-linux-gnu.tar.gz
# Install Trunk in (app dir) `/home/runner/work/folsum/folsum/` because `zola` doesn't have a path parameter.
working-directory: xtask/website
- name: Build Static Site with Zola
# Build website and output static files in `folsum/xtask/website/public/`.
run: ./zola build;
working-directory: xtask/website
#- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm
# with:
# profile: minimal
# toolchain: stable
# target: wasm32-unknown-unknown
# override: true
#- name: Rust Cache # cache the rust build artifacts
# uses: Swatinem/rust-cache@v1
#- name: Download and Install Trunk Binary
# run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-;
# # Install Trunk in (app dir) `/home/runner/work/folsum/folsum/folsum/` because `trunk` doesn't have a path parameter.
# working-directory: folsum
#- name: Build WASM Distribution with Trunk
# # "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository
# # using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
# # this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
# # relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
# # will obviously return error 404 not found.
# # Create static WASM files in `folsum/folsum/dist/`.
# run: ./trunk build --release;
# # Run build command in (app dir) `folsum/folsum/` because `trunk` doesn't have a path parameter.
# working-directory: folsum
# Deploy static files with GitHub's "static" starter workflow. https://github.com/actions/starter-workflows/blob/main/pages/static.yml
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload contents of Zola's output directory.
path: 'xtask/website/public/'
# Upload contents of Trunk's output directory.
# path: 'folsum/dist/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4