Skip to content

Commit

Permalink
try CI Pages build with artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Nov 5, 2024
1 parent 5db89df commit 2913132
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,32 @@ on:

permissions:
contents: write # for committing to gh-pages branch.
pages: write
id-token: write

jobs:
build-github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # repo checkout

- name: Set PUBLIC_URL
run: |
echo "PUBLIC_URL=https://${GITHUB_REPOSITORY_OWNER,,}.github.io/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- 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-

- 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.
Expand All @@ -38,11 +48,30 @@ jobs:
# will obviously return error 404 not found.
run: ./trunk build --release --public-url $public_url
env:
public_url: "https://${{ github.repository_owner }}.github.io/"
public_url: ${{ env.PUBLIC_URL }}

- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action
with:
path: dist/

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: 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

# Deployment job
deploy-gh-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-github-pages
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on: [push, pull_request, workflow_dispatch]

name: CI
name: CI Rust builds

env:
RUSTFLAGS: -D warnings
Expand Down

0 comments on commit 2913132

Please sign in to comment.