-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (70 loc) · 2.51 KB
/
release.yaml
File metadata and controls
82 lines (70 loc) · 2.51 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Release on Google Bucket
on:
push:
branches:
- main
- staging
jobs:
release:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref == 'refs/heads/main' && 'deploy' || 'staging' }}
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "auth staging"
if: github.ref == 'refs/heads/staging'
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/1019539084286/locations/global/workloadIdentityPools/github/providers/sourcify"
service_account: "sourcify-4byte-staging-cd@sourcify-project.iam.gserviceaccount.com"
- name: "auth main"
if: github.ref == 'refs/heads/main'
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/1019539084286/locations/global/workloadIdentityPools/github/providers/sourcify"
service_account: "sourcify-4byte-cd@sourcify-project.iam.gserviceaccount.com"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "22.4.0"
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
env:
NEXT_PUBLIC_OPENCHAIN_API_URL: ${{ vars.NEXT_PUBLIC_OPENCHAIN_API_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ vars.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
NEXT_PUBLIC_ENVIRONMENT: ${{ env.NEXT_PUBLIC_ENVIRONMENT }}
- name: "setup-gcloud"
uses: "google-github-actions/setup-gcloud@v2"
- name: Clear staging bucket
if: github.ref == 'refs/heads/staging'
run: |
# Clear the bucket
gsutil -m rm gs://4bytes-sourcify-staging/** || true
- name: Clear main bucket
if: github.ref == 'refs/heads/main'
run: |
# Clear the bucket
gsutil -m rm gs://4bytes-sourcify/** || true
- name: Upload files to staging bucket
if: github.ref == 'refs/heads/staging'
uses: "google-github-actions/upload-cloud-storage@v2"
with:
path: "out"
destination: "4bytes-sourcify-staging"
parent: false
glob: "**/*"
- name: Upload files to main bucket
if: github.ref == 'refs/heads/main'
uses: "google-github-actions/upload-cloud-storage@v2"
with:
path: "out"
destination: "4bytes-sourcify"
parent: false
glob: "**/*"