Skip to content

Commit d8b00ba

Browse files
authored
Update deploy-preview.yml
Migrate to WIF
1 parent 223cace commit d8b00ba

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

.github/workflows/deploy-preview.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Deploy Preview"
22

33
on:
44
pull_request_target:
5-
branches: [main, v3.0.0, v2.0.0]
5+
branches: [main]
66

77
jobs:
88
precheck:
@@ -130,6 +130,7 @@ jobs:
130130
contents: read
131131
pull-requests: write
132132
checks: write
133+
id-token: write # <-- 1. ADDED PERMISSION
133134
outputs:
134135
preview_url: ${{ steps.deploy_preview.outputs.details_url }}
135136

@@ -143,19 +144,26 @@ jobs:
143144
node-version: "20"
144145
cache: "yarn"
145146

146-
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4
147+
# 2. ADDED AUTHENTICATION STEP
148+
- name: Authenticate to Google Cloud
149+
uses: google-github-actions/auth@v2
150+
with:
151+
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
152+
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
153+
154+
- uses: actions/download-artifact@95815c8cf2ff2164869cbab79da8d1f422bc89e # v4
147155
with:
148156
name: build
149157

150158
- name: Unzip build artifact
151159
run: unzip build.zip
152160

161+
# 3. MODIFIED DEPLOYMENT STEP
153162
- name: Deploy to Firebase
154163
id: deploy_preview
155164
uses: FirebaseExtended/action-hosting-deploy@0cbcac4740c2bfb00d632f0b863b57713124eb5a # v0.9.0
156165
with:
157166
repoToken: "${{ secrets.GITHUB_TOKEN }}"
158-
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANDEV }}"
159167
projectId: pandev
160168
expires: 30d
161169
channelId: "pr${{ github.event.number }}"
@@ -199,28 +207,3 @@ jobs:
199207
with:
200208
name: visual_diffs
201209
path: visual_diffs
202-
203-
# - name: Comment PR with results
204-
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
205-
# uses: actions/github-script@v7
206-
# with:
207-
# github-token: ${{ secrets.GITHUB_TOKEN }}
208-
# script: |
209-
# const fs = require('fs');
210-
# const results = JSON.parse(fs.readFileSync('visual_diffs/results.json', 'utf8'));
211-
# const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
212-
# let body = `### Visual Diff Summary\n\n[View Logs](${runUrl})\n\n`;
213-
# body += `Total: ${results.summary.total}, Matches: ${results.summary.matches}, Diffs: ${results.summary.mismatches}, Skipped: ${results.summary.skipped}\n\n`;
214-
# if (results.pages.length) {
215-
# body += '| Page | Status |\n| --- | --- |\n';
216-
# for (const p of results.pages) {
217-
# if (p.status !== 'match') {
218-
# body += `| ${p.path} | ${p.status} |\n`;
219-
# }
220-
# }
221-
# }
222-
# await github.rest.issues.createComment({
223-
# ...context.repo,
224-
# issue_number: context.issue.number,
225-
# body
226-
# });

0 commit comments

Comments
 (0)