-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (46 loc) · 1.91 KB
/
deploy-to-production-on-merge-to-main.yaml
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
name: Deploy to Fly on push to main
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Cache rust dependencies and build output
uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y libc6-dev
sudo update-ca-certificates
- uses: cargo-bins/cargo-binstall@main
- name: Add build dependencies
run: |
cargo binstall cargo-leptos -y
rustup target add wasm32-unknown-unknown
- name: Build
env:
LEPTOS_BIN_TARGET_TRIPLE: x86_64-unknown-linux-gnu
run: cargo leptos build --release
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy a docker container to Fly.io
env:
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_AUTH_FLY_IO_GITHUB_ACTION }}
AUTH_SIGN_KEY: ${{ secrets.AUTH_SESSION_COOKIE_SIGNING_SECRET_KEY }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_KV_API_SECRET }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_SIGNING_OAUTH_CLIENT_CREDENTIAL_CLIENT_SECRET }}
run: |
flyctl secrets set --stage AUTH_SIGN_KEY="$AUTH_SIGN_KEY"
flyctl secrets set --stage CLOUDFLARE_API_TOKEN="$CLOUDFLARE_API_TOKEN"
flyctl secrets set --stage GOOGLE_CLIENT_SECRET="$GOOGLE_CLIENT_SECRET"
flyctl deploy --remote-only --build-arg CLOUDFLARE_ACCOUNT_IDENTIFIER=${{ secrets.CLOUDFLARE_WORKERS_KV_ACCOUNT_ID }} --build-arg CLOUDFLARE_NAMESPACE_IDENTIFIER=${{ secrets.CLOUDFLARE_WORKERS_KV_NAMESPACE_ID }} --build-arg GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_SIGNING_OAUTH_CLIENT_CREDENTIAL_CLIENT_ID }}