diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 701f65a9..5ee51571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: Continuous Integration on: pull_request + +permissions: + contents: read + jobs: module: @@ -13,6 +17,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 78bb3ba7..78490fb6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,6 +22,9 @@ on: repository_dispatch: types: [firebase_nightly_build] +permissions: + contents: read + jobs: nightly: @@ -32,6 +35,7 @@ jobs: uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: ref: ${{ github.event.client_payload.ref || github.ref }} + persist-credentials: false - name: Set up Go uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4994bec6..a2e83f1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,9 @@ on: types: - firebase_build +permissions: + contents: read + jobs: stage_release: # To publish a release, merge a PR with the title prefix '[chore] Release ' to dev @@ -47,6 +50,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Set up Go uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 @@ -81,11 +86,13 @@ jobs: environment: Release permissions: contents: write + pull-requests: write steps: - name: Checkout source for publish uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: + ref: dev persist-credentials: false - name: Publish preflight check diff --git a/.github/workflows/tag_release.yml b/.github/workflows/tag_release.yml new file mode 100644 index 00000000..5d3dc738 --- /dev/null +++ b/.github/workflows/tag_release.yml @@ -0,0 +1,51 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Tag Release + +on: + push: + branches: + - master + paths: + - 'firebase.go' + +jobs: + tag_release: + if: startsWith(github.event.head_commit.message, '[chore] Release ') + + runs-on: ubuntu-latest + environment: Release + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + + - name: Publish preflight check + id: preflight + run: ./.github/scripts/publish_preflight_check.sh + + - name: Create release tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_VER: ${{ steps.preflight.outputs.version }} + RELEASE_NOTES: ${{ steps.preflight.outputs.changelog }} + run: gh release create "$RELEASE_VER" \ + --title "Firebase Admin Go SDK $RELEASE_VER" \ + --notes "$RELEASE_NOTES" \ + --target "master"