trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.

Home Page:https://trunkrs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug when creating a build with --release --public-url

SilenLoc opened this issue · comments

version: 0.19.1

when running trunk on gh actions:

  build-github-pages:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2 # repo checkout
      - 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 artefacts
        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-
      - name: Build
        run: ./trunk build --release --public-url ${{ github.event.repository.name }}
      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: dist
          single-commit: true 

I get on the deployed site:
image

Without the public url I get the expected 404 result:
image

I also observe when running the build on ci the following:
image
(/home/runner/work/TypeFast/TypeFast)

I tried with both options for the repo name, both yield only one time ''TypeFast".

/trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
and
/trunk build --release --public-url ${{ github.event.repository.name }}

I either must be doing something wrong, or there is a bug right?
Has anyone a idea?

It even results in something like this

image

after:
SilenLoc/TypeFast@3034fd8

Try adding a leading slash to the public url. e.g. --public-url /${{ github.event.repository.name }}.

Works, thank you :)