Skip to content

Commit ab2af72

Browse files
authored
fix: Updates release workflow to run when a PR is merged to main. (#99)
1 parent 6b11489 commit ab2af72

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Google LLC
1+
# Copyright 2025 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -15,38 +15,40 @@
1515
name: Release
1616

1717
on:
18-
release:
19-
types: [published]
18+
pull_request:
19+
types: [closed]
20+
branches: [main]
2021
jobs:
21-
release:
22-
runs-on: ubuntu-latest
23-
permissions:
24-
contents: read
25-
id-token: write
26-
env:
27-
GOOGLE_MAPS_JS_SAMPLES_KEY: "${{ secrets.GOOGLE_MAPS_JS_SAMPLES_KEY }}"
28-
steps:
29-
- uses: actions/checkout@v3
30-
with:
31-
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
32-
- uses: actions/cache@v3
33-
with:
34-
path: ~/.npm
35-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
36-
restore-keys: |
37-
${{ runner.os }}-node
38-
- uses: actions/setup-node@v3
39-
with:
40-
node-version: '22.x'
41-
- run: npm i
42-
- run: npm run build-prod
22+
release:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
id-token: write
27+
if: github.event.pull_request.merged == true
28+
env:
29+
GOOGLE_MAPS_JS_SAMPLES_KEY: "${{ secrets.GOOGLE_MAPS_JS_SAMPLES_KEY }}"
30+
steps:
31+
- uses: actions/checkout@v3
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
- uses: actions/cache@v3
35+
with:
36+
path: ~/.npm
37+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
38+
restore-keys: |
39+
${{ runner.os }}-node
40+
- uses: actions/setup-node@v3
41+
with:
42+
node-version: '22.x'
43+
- run: npm i
44+
- run: npm run build-prod
4345

44-
- uses: google-github-actions/auth@v1
45-
with:
46-
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
46+
- uses: google-github-actions/auth@v1
47+
with:
48+
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
4749

48-
- name: Install Firebase CLI
49-
run: npm install -g firebase-tools
50+
- name: Install Firebase CLI
51+
run: npm install -g firebase-tools
5052

51-
- name: Deploy to Firebase Hosting
52-
run: firebase deploy --only hosting
53+
- name: Deploy to Firebase Hosting
54+
run: firebase deploy --only hosting

0 commit comments

Comments
 (0)