Skip to content

chore(deps): soft update #63

chore(deps): soft update

chore(deps): soft update #63

Workflow file for this run

name: Github Pages
# only trigger when relevant files change on main branch
on:
workflow_dispatch:
push:
branches:
- main
# paths:
# - "crates/${{ env.WASM_TRUNK_DEPLOY_CRATE }}/**"
# - "Cargo.toml"
# - "Cargo.lock"
# - ".github/workflows/pages.yml"
# to only run when you do a new github release, comment out above part and uncomment the below trigger.
# on:
# release:
# types:
# - published
env:
WASM_TRUNK_DEPLOY_CRATE: sample-webapp
# RUSTFLAGS: -D warnings
# RUSTDOCFLAGS: -D warnings
# NIGHTLY_VERSION: nightly-20xx-yy-zz
permissions:
contents: write # for committing to gh-pages branch.
jobs:
build-github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # repo checkout
# check that specified crate (see env above) is present and contains `index.html`
- name: Verify deployment crate exists
run: |
if [ ! -d "crates/${{ env.WASM_TRUNK_DEPLOY_CRATE }}" ]; then
echo "Error: Deployment crate '${{ env.WASM_TRUNK_DEPLOY_CRATE }}' not found"
exit 1
fi
if [ ! -f "crates/${{ env.WASM_TRUNK_DEPLOY_CRATE }}/index.html" ]; then
echo "Error: index.html not found in '${{ env.WASM_TRUNK_DEPLOY_CRATE }}'"
exit 1
fi
- name: Setup toolchain for wasm
run: |
rustup update stable
rustup default stable
rustup set profile minimal
rustup target add wasm32-unknown-unknown
- name: Rust Cache # cache the rust build artefacts
uses: Swatinem/rust-cache@v2
- 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-
sudo mv trunk /usr/local/bin/
# uses: jetli/[email protected] <-- an alternate option?; above comes from emilk/eframe_template
- name: Build # build
# Environment $public_url resolves to the github project page.
# If using a user/organization page, remove the `${{ github.event.repository.name }}` part.
# 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 egui_xp/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.
# NOTE: running in local directory will create a dist/ in that local directory as well. (so `./crates/cratename/dist`)
working-directory: crates/${{ env.WASM_TRUNK_DEPLOY_CRATE }}
run: trunk build --release --public-url $PUBLIC_URL
env:
PUBLIC_URL: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
# branch: gh-pages # gh-pages is the default branch to push to and deploy from
folder: crates/${{ env.WASM_TRUNK_DEPLOY_CRATE }}/dist
# this option will not maintain any history of your previous pages deployment
# set to false if you want all page build to be committed to your gh-pages branch history
single-commit: true
# -------- alternate matrix approach for multiple deploys -------- #
# # build-github-pages:
# strategy:
# matrix:
# crate: [sample-webapp, sample-egui] # List crates to deploy
# include:
# - crate: sample-webapp
# path: web # Deploy to custom path
# - crate: sample-egui
# path: gui # Deploy to custom path
# ...
# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# folder: dist
# single-commit: true
# path: ${{ matrix.path }} # Deploy to subdirectory