Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,32 @@
name: Release Candidate

on:
# Only run the workflow when a PR is updated or when a developer explicitly requests
# a build by sending a 'firebase_build' event.
# Run the workflow when:
# 1. A PR is created or updated (staging checks).
# 2. A commit is pushed to main (release publication).
# 3. A developer explicitly requests a build via 'firebase_build' event.
pull_request:
types: [opened, synchronize, closed]
types: [opened, synchronize]

push:
branches:
- main
paths:
- 'FirebaseAdmin/FirebaseAdmin/FirebaseAdmin.csproj'

repository_dispatch:
types:
- firebase_build

jobs:
stage_release:
# To publish a release, merge the release PR with the label 'release:publish'.
# To publish a release, merge a PR with the title prefix '[chore] Release ' to main
# and ensure the squashed commit message also has the prefix.
# To stage a release without publishing it, send a 'firebase_build' event or apply
# the 'release:stage' label to a PR.
if: github.event.action == 'firebase_build' ||
contains(github.event.pull_request.labels.*.name, 'release:stage') ||
(github.event.pull_request.merged &&
contains(github.event.pull_request.labels.*.name, 'release:publish'))
(github.event_name == 'push' && startsWith(github.event.head_commit.message, '[chore] Release '))

# Build and package artifacts on Windows.
runs-on: ubuntu-latest
Expand All @@ -42,14 +50,9 @@ jobs:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1

# When manually triggering the build, the requester can specify a target branch or a tag
# via the 'ref' client parameter.
steps:
- name: Checkout source for staging
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{ github.event.client_payload.ref || github.ref }}


- name: Setup .NET
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
Expand Down Expand Up @@ -90,15 +93,13 @@ jobs:
publish_release:
needs: stage_release

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

# Use Linux for this phase, so we can reuse the same helper scripts as other Admin SDK
# repositories.
Expand Down Expand Up @@ -136,9 +137,12 @@ jobs:
- name: Create release tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.preflight.outputs.version }}
--title "Firebase Admin .NET SDK ${{ steps.preflight.outputs.version }}"
--notes '${{ steps.preflight.outputs.changelog }}'
RELEASE_VER: ${{ steps.preflight.outputs.version }}
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
run: |
gh release create "$RELEASE_VER" \
--title "Firebase Admin .NET SDK $RELEASE_VER" \
--notes "$RELEASE_BODY"

# Login to NuGet using OIDC and generate a short-lived NuGet API key
- name: Nuget login
Expand Down
Loading