Skip to content

Add build step to check-pr CI job #87

Add build step to check-pr CI job

Add build step to check-pr CI job #87

name: Build & Deploy
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_BUCKET: ${{ secrets.GCP_BUCKET }}
APP_HOST: ${{ secrets.APP_HOST }}
on:
push:
branches:
- 'main'
jobs:
check:
name: Check code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Add nightly channel'
run: 'rustup toolchain install nightly'
- name: 'Add nightly fmt'
run: 'rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu'
- name: 'Fmt'
run: 'cargo +nightly fmt --all -- --check'
- name: 'Clippy'
run: 'cargo clippy --all-targets -- -D warnings'
- name: 'Tests'
run: 'cargo test'
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: check
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Trunk Check'
uses: jetli/trunk-action@v0.4.0
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SERVICE_KEY }}'
- name: 'Add WASM target'
run: 'rustup target add wasm32-unknown-unknown'
- name: 'Build'
run: 'trunk build --release'
- name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@v2
- name: 'Deploy'
run: 'gsutil -h "Cache-Control:no-store" -m cp -r dist/* gs://${GCP_BUCKET}'