-
Notifications
You must be signed in to change notification settings - Fork 8
66 lines (51 loc) · 1.42 KB
/
github-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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@v3
- 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 -- -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@v3
- name: 'Trunk Check'
uses: jetli/trunk-action@v0.4.0
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
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@v0
- name: 'Deploy'
run: 'gsutil -h "Cache-Control:no-store" -m cp -r dist/* gs://${GCP_BUCKET}'