-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (80 loc) · 3.12 KB
/
staging.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Deploy to Staging
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- develop
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.STAGING_PROJECT_ID }}
SUPABASE_API_URL: "https://${{ secrets.STAGING_PROJECT_ID }}.supabase.co"
SUPABASE_ANON_KEY: ${{ secrets.STAGING_ANON_KEY }}
ENV: staging
APP_URL: https://staging.talkbirdyto.me
RUST_LOG: debug
steps:
- uses: actions/checkout@v4
- name: Install npm
uses: actions/setup-node@v4
# Install Rust with the `rust-toolchain` action.
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: wasm32-unknown-unknown
# Use another action to cache our files when possible.
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/develop' }}
# Install a tool that makes it quicker to install other tools.
- uses: cargo-bins/cargo-binstall@main
# Compile CSS
- name: Compile css
working-directory: app
run: npm ci ; npx tailwindcss --minify --input ./input.css --output ./assets/tailwind.css
# dotenvy requires this
- run: cp .env.example .env
# Install the Dioxus CLI
- name: Install Dioxus
# run: cargo binstall dioxus-cli -y --force
run: cargo install --git https://github.com/DioxusLabs/dioxus.git dioxus-cli --locked
# Build our Dioxus app in release.
- name: Build app
working-directory: app
run: dx build --release --platform web --features web
# Fixup index.html (see https://github.com/DioxusLabs/dioxus/issues/2847)
- name: Fixup index.html
run: |
cd dist
for f in *.css; do
sed -i "/<\/head>/i <link rel=\"stylesheet\" href=\"/$(basename "$f")\">" index.html
done
sed -i 's/<html>/<html lang="en">/' index.html
# Create our required `404.html` page.
- name: Create 404.html
run: cp dist/index.html dist/404.html
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- name: "Deploy migrations to staging"
run: supabase db push
# Now we call for another GitHub action to run. This action copies our
# built site and pushes it to our `gh-pages` branch.
- name: Deploy app to Render
uses: JamesIves/[email protected]
with:
branch: static-develop # The branch we have GitHub pages setup in.
folder: dist # The folder we want to copy to the `gh-pages` branch.
target-folder: . # The destination we want our files copied to. In this case, we want them to be a the root level.
clean: true