|
1 | 1 | name: Release on Google Bucket |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - main |
| 7 | + - staging |
| 8 | + |
6 | 9 | jobs: |
7 | 10 | release: |
8 | 11 | runs-on: ubuntu-latest |
9 | | - environment: deploy |
| 12 | + environment: |
| 13 | + name: ${{ github.ref == 'refs/heads/main' && 'deploy' || 'staging' }} |
10 | 14 | permissions: |
11 | 15 | contents: read |
12 | 16 | packages: write |
13 | 17 | id-token: write |
14 | 18 | steps: |
15 | 19 | - name: Checkout repository |
16 | 20 | uses: actions/checkout@v4 |
17 | | - - name: "auth" |
| 21 | + |
| 22 | + - name: "auth staging" |
| 23 | + if: github.ref == 'refs/heads/staging' |
18 | 24 | uses: "google-github-actions/auth@v2" |
19 | 25 | with: |
20 | 26 | workload_identity_provider: "projects/1019539084286/locations/global/workloadIdentityPools/github/providers/sourcify" |
21 | | - service_account: "[email protected]" |
| 27 | + service_account: "sourcify-4byte-staging-cd@sourcify-project.iam.gserviceaccount.com" |
| 28 | + |
| 29 | + - name: "auth main" |
| 30 | + if: github.ref == 'refs/heads/main' |
| 31 | + uses: "google-github-actions/auth@v2" |
| 32 | + with: |
| 33 | + workload_identity_provider: "projects/1019539084286/locations/global/workloadIdentityPools/github/providers/sourcify" |
| 34 | + service_account: "[email protected]" |
| 35 | + |
22 | 36 | - name: Set up Node.js |
23 | 37 | uses: actions/setup-node@v3 |
24 | 38 | with: |
25 | 39 | node-version: "22.4.0" |
| 40 | + |
26 | 41 | - name: Install dependencies |
27 | 42 | run: npm install |
| 43 | + |
28 | 44 | - name: Build |
29 | 45 | run: npm run build |
30 | 46 | env: |
31 | 47 | NEXT_PUBLIC_OPENCHAIN_API_URL: ${{ vars.NEXT_PUBLIC_OPENCHAIN_API_URL }} |
32 | 48 | NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ vars.NEXT_PUBLIC_UMAMI_WEBSITE_ID }} |
| 49 | + |
33 | 50 | - name: "setup-gcloud" |
34 | 51 | uses: "google-github-actions/setup-gcloud@v2" |
35 | 52 |
|
36 | | - - name: Clear bucket |
| 53 | + - name: Clear staging bucket |
37 | 54 | if: github.ref == 'refs/heads/staging' |
| 55 | + run: | |
| 56 | + # Clear the bucket |
| 57 | + gsutil -m rm gs://4bytes-sourcify-staging/** || true |
| 58 | +
|
| 59 | + - name: Clear main bucket |
| 60 | + if: github.ref == 'refs/heads/main' |
38 | 61 | run: | |
39 | 62 | # Clear the bucket |
40 | 63 | gsutil -m rm gs://4bytes-sourcify/** || true |
41 | | - - name: "upload-files" |
| 64 | +
|
| 65 | + - name: Upload files to staging bucket |
| 66 | + if: github.ref == 'refs/heads/staging' |
| 67 | + uses: "google-github-actions/upload-cloud-storage@v2" |
| 68 | + with: |
| 69 | + path: "out" |
| 70 | + destination: "4bytes-sourcify-staging" |
| 71 | + parent: false |
| 72 | + glob: "**/*" |
| 73 | + |
| 74 | + - name: Upload files to main bucket |
| 75 | + if: github.ref == 'refs/heads/main' |
42 | 76 | uses: "google-github-actions/upload-cloud-storage@v2" |
43 | 77 | with: |
44 | 78 | path: "out" |
|
0 commit comments