Repository navigation
63 lines (53 loc) · 1.76 KB
/
Copy pathdeploy.yml
File metadata and controls
63 lines (53 loc) · 1.76 KB
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
name: Deploy to GCS
on:
push:
branches:
- staging
- prod
jobs:
deploy:
name: Build and Deploy
runs-on: ubuntu-24.04
environment: ${{ github.ref_name }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install OTP and Gleam
uses: erlef/setup-beam@v1
with:
otp-version: 27.2
gleam-version: 1.12.0
rebar3-version: 3
- name: Install dependencies
run: gleam deps download
- name: Build application
run: gleam run -m lustre/dev build
- name: Copy 404.html to dist
run: cp assets/404.html dist/404.html
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
- name: Upload to GCS
uses: google-github-actions/upload-cloud-storage@v2
with:
path: dist
destination: ${{ secrets.GCS_BUCKET }}
parent: false
headers: |-
cache-control: public, max-age=86400
x-goog-meta-surrogate-key: static
process_gcloudignore: false
- name: Purge Fastly cache
run: |
curl -X POST "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/static" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_TOKEN }}" \
-H "Accept: application/json"
sleep 5
curl -X POST "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/static" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_TOKEN }}" \
-H "Accept: application/json"