Skip to content

Commit 86a4642

Browse files
authored
Merge branch 'firebase:main' into master
2 parents 8cc1547 + d11b211 commit 86a4642

File tree

1 file changed

+25
-35
lines changed

1 file changed

+25
-35
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,38 @@
1515
name: Release Candidate
1616

1717
on:
18-
# Only run the workflow when a PR is updated or when a developer explicitly requests
19-
# a build by sending a 'firebase_build' event.
18+
# Run the workflow when:
19+
# 1. A PR is created or updated (staging checks).
20+
# 2. A commit is pushed to main (release publication).
21+
# 3. A developer explicitly requests a build via 'firebase_build' event.
2022
pull_request:
21-
types: [opened, synchronize, closed]
23+
types: [opened, synchronize]
24+
25+
push:
26+
branches:
27+
- main
28+
paths:
29+
- 'firebase_admin/__about__.py'
2230

2331
repository_dispatch:
2432
types:
2533
- firebase_build
2634

2735
jobs:
2836
stage_release:
29-
# To publish a release, merge the release PR with the label 'release:publish'.
37+
# To publish a release, merge a PR with the title prefix '[chore] Release ' to main
38+
# and ensure the squashed commit message also has the prefix.
3039
# To stage a release without publishing it, send a 'firebase_build' event or apply
3140
# the 'release:stage' label to a PR.
3241
if: github.event.action == 'firebase_build' ||
3342
contains(github.event.pull_request.labels.*.name, 'release:stage') ||
34-
(github.event.pull_request.merged &&
35-
contains(github.event.pull_request.labels.*.name, 'release:publish'))
43+
(github.event_name == 'push' && startsWith(github.event.head_commit.message, '[chore] Release '))
3644

3745
runs-on: ubuntu-latest
3846

39-
# When manually triggering the build, the requester can specify a target branch or a tag
40-
# via the 'ref' client parameter.
4147
steps:
4248
- name: Checkout source for staging
4349
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # 4.3.1
44-
with:
45-
ref: ${{ github.event.client_payload.ref || github.ref }}
4650

4751
- name: Set up Python
4852
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # 5.6.0
@@ -82,15 +86,13 @@ jobs:
8286
publish_release:
8387
needs: stage_release
8488

85-
# Check whether the release should be published. We publish only when the trigger PR is
86-
# 1. merged
89+
# Check whether the release should be published. We publish only when the trigger is
90+
# 1. a push (merge)
8791
# 2. to the main branch
88-
# 3. with the label 'release:publish', and
89-
# 4. the title prefix '[chore] Release '.
90-
if: github.event.pull_request.merged &&
92+
# 3. and the commit message has the title prefix '[chore] Release '.
93+
if: github.event_name == 'push' &&
9194
github.ref == 'refs/heads/main' &&
92-
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
93-
startsWith(github.event.pull_request.title, '[chore] Release ')
95+
startsWith(github.event.head_commit.message, '[chore] Release ')
9496

9597
runs-on: ubuntu-latest
9698
environment: Release
@@ -120,24 +122,12 @@ jobs:
120122
- name: Create release tag
121123
env:
122124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123-
run: gh release create ${{ steps.preflight.outputs.version }}
124-
--title "Firebase Admin Python SDK ${{ steps.preflight.outputs.version }}"
125-
--notes '${{ steps.preflight.outputs.changelog }}'
125+
RELEASE_VER: ${{ steps.preflight.outputs.version }}
126+
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
127+
run: |
128+
gh release create "$RELEASE_VER" \
129+
--title "Firebase Admin Python SDK $RELEASE_VER" \
130+
--notes "$RELEASE_BODY"
126131
127132
- name: Publish to Pypi
128133
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
129-
130-
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
131-
- name: Post to Twitter
132-
if: success() &&
133-
contains(github.event.pull_request.labels.*.name, 'release:tweet')
134-
uses: firebase/firebase-admin-node/.github/actions/send-tweet@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
135-
with:
136-
status: >
137-
${{ steps.preflight.outputs.version }} of @Firebase Admin Python SDK is available.
138-
https://github.com/firebase/firebase-admin-python/releases/tag/${{ steps.preflight.outputs.version }}
139-
consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }}
140-
consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
141-
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
142-
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
143-
continue-on-error: true

0 commit comments

Comments
 (0)