fix workflow pt2 #33
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: Deploy Rust Project to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Cache Rust dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install minimal nightly with clippy and rustfmt | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rustfmt, clippy | |
- name: Install cargo-generate | |
run: cargo generate --version || cargo install cargo-generate | |
- name: Install trunk | |
run: trunk --version || cargo install trunk | |
# rustfmt just broken? | |
# - name: Run rustfmt | |
# run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
- name: Add wasm target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Install nodejs deps | |
run: | | |
cd app | |
npm install | |
cd .. | |
- name: Build Rust project with trunk | |
run: trunk build | |
- name: Copy CNAME for custom domain | |
run: cp CNAME ./app/dist/ | |
- name: Create 404 redirection for SPA | |
run: cp app/dist/index.html app/dist/404.html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.PAT }} | |
publish_dir: ./app/dist |