Skip to content

Commit 6e297d4

Browse files
chore: Update Release Workflows for Push triggers (#745)
* chore: Update release actions to run on Release env * Trigger CI * update the actions * update the base_ref * remove fetch-depth to prevent conflicts
1 parent 1c367ca commit 6e297d4

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,9 @@ jobs:
3636

3737
runs-on: ubuntu-latest
3838

39-
# When manually triggering the build, the requester can specify a target branch or a tag
40-
# via the 'ref' client parameter.
4139
steps:
4240
- name: Check out code
4341
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
44-
with:
45-
ref: ${{ github.event.client_payload.ref || github.ref }}
4642

4743
- name: Set up Go
4844
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
@@ -71,19 +67,19 @@ jobs:
7167
# 3. with the label 'release:publish', and
7268
# 4. the title prefix '[chore] Release '.
7369
if: github.event.pull_request.merged &&
74-
github.ref == 'refs/heads/dev' &&
70+
github.base_ref == 'dev' &&
7571
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
7672
startsWith(github.event.pull_request.title, '[chore] Release ')
7773

7874
runs-on: ubuntu-latest
79-
environment: Release
8075
permissions:
81-
contents: write
76+
pull-requests: write
8277

8378
steps:
8479
- name: Checkout source for publish
8580
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
8681
with:
82+
ref: dev
8783
persist-credentials: false
8884

8985
- name: Publish preflight check
@@ -94,10 +90,11 @@ jobs:
9490
- name: Create Release PR
9591
env:
9692
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
94+
RELEASE_TITLE: "[chore] Release ${{ steps.preflight.outputs.version }}"
9795
run: |
9896
gh pr create \
9997
--base master \
10098
--head dev \
101-
--title "[chore] Release ${{ steps.preflight.outputs.version }}" \
102-
--body "${{ steps.preflight.outputs.changelog }}" \
103-
--label "release:tag"
99+
--title "$RELEASE_TITLE" \
100+
--body "$RELEASE_BODY"

.github/workflows/tag_release.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@
1515
name: Tag Release
1616

1717
on:
18-
pull_request:
19-
types: [closed]
18+
push:
19+
branches:
20+
- master
21+
paths:
22+
- 'firebase.go'
2023

2124
jobs:
2225
tag_release:
23-
# Trigger only when:
24-
# 1. The PR is merged.
25-
# 2. The PR targets the master branch.
26-
# 3. The PR has the label 'release:tag'.
27-
if: github.event.pull_request.merged &&
28-
github.event.pull_request.base.ref == 'master' &&
29-
contains(github.event.pull_request.labels.*.name, 'release:tag') &&
30-
startsWith(github.event.pull_request.title, '[chore] Release ')
26+
if: startsWith(github.event.head_commit.message, '[chore] Release ')
3127

3228
runs-on: ubuntu-latest
3329
environment: Release
@@ -37,18 +33,17 @@ jobs:
3733
steps:
3834
- name: Checkout code
3935
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
40-
with:
41-
ref: master
4236

4337
- name: Publish preflight check
4438
id: preflight
4539
run: ./.github/scripts/publish_preflight_check.sh
4640

47-
# See: https://cli.github.com/manual/gh_release_create
4841
- name: Create release tag
4942
env:
5043
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
run: gh release create ${{ steps.preflight.outputs.version }}
52-
--title "Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}"
53-
--notes '${{ steps.preflight.outputs.changelog }}'
44+
RELEASE_VER: ${{ steps.preflight.outputs.version }}
45+
RELEASE_NOTES: ${{ steps.preflight.outputs.changelog }}
46+
run: gh release create "$RELEASE_VER" \
47+
--title "Firebase Admin Go SDK $RELEASE_VER" \
48+
--notes "$RELEASE_NOTES" \
5449
--target "master"

0 commit comments

Comments
 (0)