Enable trunk action in verify workflow #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: Deploy to Container | |
on: | |
push: | |
branches: [mainline] | |
paths-ignore: | |
- "**.md" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown | |
components: clippy, rustfmt | |
- uses: jetli/[email protected] | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-artifacts-${{ hashFiles('**/Cargo.lock') }} | |
- name: Lint | |
run: cargo fmt -- --check | |
- name: Clippy | |
run: cargo clippy -- -D warnings --no-deps | |
- name: Test | |
run: cargo test | |
- name: Build | |
run: cargo build --release | |
- name: Webpack | |
run: trunk build --release website/index.html | |
- name: Upload WASM | |
uses: actions/upload-artifact@v1 | |
with: | |
name: dist | |
path: website/dist | |
deploy-website: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
environment: | |
name: us-east-1 | |
needs: build | |
steps: | |
- name: Download WASM | |
uses: actions/download-artifact@v1 | |
with: | |
name: dist | |
- name: Upload to S3 | |
uses: reggionick/s3-deploy@v4 | |
with: | |
folder: dist | |
bucket: ${{ secrets.S3_BUCKET }} | |
bucket-region: ${{ vars.AWS_DEFAULT_REGION }} | |
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
invalidation: / * | |
private: true | |
delete-removed: true |