Selection done. #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy to GitHub pages. | |
on: | |
# Run on push to master | |
push: | |
branches: ["master"] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN. | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
# Check job | |
check: | |
name: cargo test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Rust installation | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: clippy | |
- name: Test | |
run: cargo test --all-features | |
- name: Format | |
uses: actions-rust-lang/rustfmt@v1 | |
- name: Lint | |
run: cargo clippy --all-targets --all-features --locked -- -D warnings | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Rust installation | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: wasm32-unknown-unknown | |
- name: Install Trunk | |
run: cargo install trunk | |
- name: Build with Trunk | |
run: trunk build --release --public-url=/${{ github.event.repository.name }} | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist/ | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |