Skip to content

Fix github cd permissions. #10

Fix github cd permissions.

Fix github cd permissions. #10

Workflow file for this run

name: Build Gallery
on:
push:
paths:
- 'src/**'
- 'test-app/**'
- '.github/workflows/cd.yml'
pull_request:
paths:
- 'src/**'
- 'test-app/**'
- '.github/workflows/cd.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
# Add WebAssembly target
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
# Download and install Trunk
- name: Install Trunk
uses: baptiste0928/cargo-install@v2
with:
crate: trunk
version: 0.15.0
# Install wasm-opt
- name: Install wasm-opt
uses: baptiste0928/cargo-install@v2
with:
crate: wasm-opt
# Build wasm
- name: Build WASM
run: mkdir docs && cd test-app && trunk --config Trunk.prod.toml build --release --filehash=false
# Optmize wasm (We should use a higher level, but it never completes)
- name: Optimize WASM
continue-on-error: true
timeout-minutes: 10
run: |
ls docs -l
wasm-opt docs/test-app_bg.wasm -o docs/test-app_bg.opt.wasm -O1 --debug --strip-dwarf --strip-debug
mv docs/test-app_bg.opt.wasm docs/test-app_bg.wasm
# Deploy
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './docs/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2