Merge pull request #49 from Altair-Bueno/master #35
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 Yew app | |
on: | |
push: | |
branches: | |
- release | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
name: Build and deploy | |
env: | |
TARGET: wasm-unknown | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
name: Cache cargo | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-binaries | |
- uses: actions/cache@v2 | |
name: Cache rustc | |
with: | |
path: | | |
${{ env.working-directory }}/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Set up toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
- name: Install Yew's toolkit | |
continue-on-error: true | |
run: cargo install trunk wasm-bindgen-cli | |
- name: Install chevron | |
continue-on-error: true | |
run: pip3 install chevron | |
- name: Build template | |
run: python3 template.py | |
- name: Build website | |
run: trunk build --release | |
- name: Move resources to destination | |
run: | | |
rm -fr docs/ | |
mv dist docs | |
cp docs/index.html docs/404.html | |
- name: Push back changes | |
continue-on-error: true | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email 'github-actions@github.com' | |
git add -f docs/ | |
git commit -am "Generated website" | |
git push |