Skip to content

Commit 4f7026f

Browse files
github-actions[bot]jonathanedeylahirumaramba
authored
[chore] Release v4.19.0 (#747)
* chore: Added and `AGENTS.md` file to instruct AI agents how to interact with this repository (#710) * fix(auth): Fixed auth error code parsing (#712) * fix(auth): Fixed auth error code parsing * fix(auth): Fixed test to use error message prefix * chore: update copyright headers from Google Inc. to Google LLC (#713) * chore: Update github actions workflows and integration test resources (#740) * chore: Pinned github actions to a full-length commit SHA * chore: Update integration test resources * chore: Added environment label to release action * Trigger integration tests * feat(firestore): Added Firestore Multi Database Support (#733) * feat(firestore): Add Firestore Multi Database Support * fix: Address gemini review * fix: gemini review * fix: Update name from API review * fix: Address review comments * chore: Fix CONTRIBUTING.md typo Co-authored-by: Lahiru Maramba <llahiru@gmail.com> --------- Co-authored-by: Lahiru Maramba <llahiru@gmail.com> * feat(auth): Add `QueryUsers` API (#727) This change implements the accounts:query functionality, providing a new QueryUsers method that allows searching for users with filters and sorting options. RELEASE_NOTE: Added QueryUsers() API to support querying user accounts with filters, sorting, and pagination. * Update the release actions process (#741) This PR refactors the release automation to improve security by removing the direct merge from the workflow. * [chore] Release 4.19.0 (#742) * Revert "[chore] Release 4.19.0 (#742)" (#744) This reverts commit 3a86709. * 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 * [chore] Release 4.19.0 Take 2 (#746) --------- Co-authored-by: Jonathan Edey <145066863+jonathanedey@users.noreply.github.com> Co-authored-by: Lahiru Maramba <llahiru@gmail.com>
1 parent 26dec0b commit 4f7026f

File tree

87 files changed

+923
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+923
-148
lines changed
-6 Bytes
Binary file not shown.

.github/scripts/generate_changelog.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2020 Google Inc.
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

.github/scripts/publish_preflight_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2020 Google Inc.
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

.github/scripts/run_all_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2020 Google Inc.
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212

1313
steps:
1414
- name: Check out code
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1616

1717
- name: Set up Go ${{ matrix.go }}
18-
uses: actions/setup-go@v5
18+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1919
with:
2020
go-version: ${{ matrix.go }}
2121

.github/workflows/nightly.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 Google Inc.
1+
# Copyright 2021 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.
@@ -29,12 +29,12 @@ jobs:
2929

3030
steps:
3131
- name: Check out code
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3333
with:
3434
ref: ${{ github.event.client_payload.ref || github.ref }}
3535

3636
- name: Set up Go
37-
uses: actions/setup-go@v5
37+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
3838
with:
3939
go-version: '1.23'
4040

@@ -53,7 +53,7 @@ jobs:
5353

5454
- name: Send email on failure
5555
if: failure()
56-
uses: firebase/firebase-admin-node/.github/actions/send-email@master
56+
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
5757
with:
5858
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
5959
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Send email on cancelled
7070
if: cancelled()
71-
uses: firebase/firebase-admin-node/.github/actions/send-email@master
71+
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
7272
with:
7373
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
7474
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}

.github/workflows/release.yml

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Google Inc.
1+
# Copyright 2020 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.
@@ -36,16 +36,12 @@ 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
43-
uses: actions/checkout@v4
44-
with:
45-
ref: ${{ github.event.client_payload.ref || github.ref }}
41+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4642

4743
- name: Set up Go
48-
uses: actions/setup-go@v5
44+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
4945
with:
5046
go-version: '1.23'
5147

@@ -71,57 +67,34 @@ 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
7975
permissions:
80-
contents: write
76+
pull-requests: write
8177

8278
steps:
8379
- name: Checkout source for publish
84-
uses: actions/checkout@v4
80+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
8581
with:
82+
ref: dev
8683
persist-credentials: false
8784

8885
- name: Publish preflight check
8986
id: preflight
9087
run: ./.github/scripts/publish_preflight_check.sh
9188

92-
# We authorize this step with an access token that has write access to the master branch.
93-
- name: Merge to master
94-
uses: actions/github-script@v7
95-
with:
96-
github-token: ${{ secrets.FIREBASE_GITHUB_TOKEN }}
97-
script: |
98-
github.rest.repos.merge({
99-
owner: context.repo.owner,
100-
repo: context.repo.repo,
101-
base: 'master',
102-
head: 'dev'
103-
})
104-
105-
# See: https://cli.github.com/manual/gh_release_create
106-
- name: Create release tag
89+
# Create a PR to merge dev into master.
90+
- name: Create Release PR
10791
env:
10892
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109-
run: gh release create ${{ steps.preflight.outputs.version }}
110-
--title "Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}"
111-
--notes '${{ steps.preflight.outputs.changelog }}'
112-
--target "master"
113-
114-
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
115-
- name: Post to Twitter
116-
if: success() &&
117-
contains(github.event.pull_request.labels.*.name, 'release:tweet')
118-
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
119-
with:
120-
status: >
121-
${{ steps.preflight.outputs.version }} of @Firebase Admin Go SDK is available.
122-
https://github.com/firebase/firebase-admin-go/releases/tag/${{ steps.preflight.outputs.version }}
123-
consumer-key: ${{ secrets.FIREBASE_TWITTER_CONSUMER_KEY }}
124-
consumer-secret: ${{ secrets.FIREBASE_TWITTER_CONSUMER_SECRET }}
125-
access-token: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN }}
126-
access-token-secret: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN_SECRET }}
127-
continue-on-error: true
93+
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
94+
RELEASE_TITLE: "[chore] Release ${{ steps.preflight.outputs.version }}"
95+
run: |
96+
gh pr create \
97+
--base master \
98+
--head dev \
99+
--title "$RELEASE_TITLE" \
100+
--body "$RELEASE_BODY"

.github/workflows/tag_release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Tag Release
16+
17+
on:
18+
push:
19+
branches:
20+
- master
21+
paths:
22+
- 'firebase.go'
23+
24+
jobs:
25+
tag_release:
26+
if: startsWith(github.event.head_commit.message, '[chore] Release ')
27+
28+
runs-on: ubuntu-latest
29+
environment: Release
30+
permissions:
31+
contents: write
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
36+
37+
- name: Publish preflight check
38+
id: preflight
39+
run: ./.github/scripts/publish_preflight_check.sh
40+
41+
- name: Create release tag
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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" \
49+
--target "master"

AGENTS.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Firebase Admin Go SDK - Agent Guide
2+
3+
This document provides a comprehensive guide for AI agents to understand the conventions, design patterns, and architecture of the Firebase Admin Go SDK. Adhering to these guidelines is crucial for making idiomatic and consistent code contributions.
4+
5+
## 1. High-Level Overview
6+
7+
The Firebase Admin Go SDK enables server-side (backend) applications to interact with Firebase services. Its design emphasizes idiomatic Go, thread-safety, and a consistent, discoverable API surface.
8+
9+
## 2. Directory Structure
10+
11+
- `firebase.go`: The primary entry point for initializing a Firebase `App` instance.
12+
- `internal/`: Contains private implementation details, such as HTTP clients and utility functions, that are not part of the public API.
13+
- `auth/`, `db/`, `messaging/`, etc.: Each directory contains a specific Firebase service client.
14+
- `*_test.go`: Unit tests are located alongside the code they test (e.g., `auth/auth_test.go`).
15+
- `integration/`: Contains integration tests that make live network calls to Firebase services.
16+
- `snippets/`: Contains code snippets used in documentation.
17+
- `errorutils/`: Contains common error type checkers and other error handling utils.
18+
- `testdata/`: Contains mock data used in some tests.
19+
20+
## 3. Core Design Patterns
21+
22+
- **Initialization:** The SDK is initialized by creating an `App` instance via `firebase.NewApp()`. This `App` object is the central point for accessing all service clients.
23+
- **Service Clients:** Service clients (e.g., `auth.Client`, `db.Client`) are obtained from the `App` instance (e.g., `app.Auth(ctx)`). These clients are lightweight and are typically created as needed.
24+
- **Error Handling:** Errors are handled using standard Go idioms. Firbase errors are defined in `internal/errors.go` however these errors can be further modified within each service. This modification is applied using that service's set `internal.HTTPClient.CreateErrFn` value.
25+
- **HTTP Communication:** All outgoing HTTP requests are managed by a centralized client located in `internal/http_client.go`. This ensures consistent handling of authentication, retries, and error parsing.
26+
- **Asynchronous Operations:** The SDK uses `context.Context` to manage deadlines, cancellations, and request-scoped values for all asynchronous operations.
27+
28+
## 4. Coding Style and Naming Conventions
29+
30+
- **Naming:**
31+
- Public functions, types, and fields use `PascalCase`.
32+
- Private functions and types use `camelCase`.
33+
- Constants are written in `PascalCase`.
34+
35+
## 5. Testing Philosophy
36+
37+
- **Unit Tests:** Unit tests follow the `*_test.go` naming pattern and are placed in the same directory as the code under test. They use standard Go testing packages and mocks to isolate dependencies.
38+
- **Integration Tests:** Integration tests are located in the `integration/` directory. They are designed to run against actual Firebase services and require a configured Firebase project.
39+
40+
## 6. Dependency Management
41+
42+
- **Manager:** The SDK uses Go Modules for dependency management.
43+
- **Manifest:** Dependencies are declared in the `go.mod` file.
44+
- **Command:** To add or update dependencies, use `go get` or `go mod tidy`.
45+
46+
## 7. Critical Developer Journeys
47+
48+
### Journey 1: How to Add a New API Method
49+
50+
1. **Define Public Method:** Add the new method or change to the appropriate service client files (e.g., `auth/user_mgt.go`).
51+
2. **Internal Logic:** Implement the core logic within the service package.
52+
3. **HTTP Client:** Use the client in `internal/http_client.go` to make the API calls.
53+
4. **Error Handling:** New or updated error codes implemented in the appropriate location.
54+
5. **Testing:**
55+
- Add unit tests in the corresponding `*_test.go` file (e.g., `auth/user_mgt_test.go`).
56+
- Add integration tests in the `integration/` directory if applicable.
57+
6. **Snippets:** (Optional) Add or update code snippets in the `snippets/` directory.
58+
59+
### Journey 2: How to Deprecate a Field/Method in an Existing API
60+
61+
1. **Add Deprecation Note:** Locate where the deprecated object is defined and add a deprecation warning with a note (e.g. `// Deprecated: Use X instead.`).
62+
63+
## 8. Critical Do's and Don'ts
64+
65+
- **DO:** Use the centralized HTTP client in `internal/http_client.go` for all network calls.
66+
- **DO:** Pass `context.Context` as the first argument to all functions that perform I/O or other blocking operations.
67+
- **DO:** Run `go fmt` after implementing a change and fix any linting errors.
68+
- **DON'T:** Expose types or functions from the `internal/` directory in the public API.
69+
- **DON'T:** Introduce new third-party dependencies without a strong, documented justification and team consensus.
70+
71+
## 9. Branch Creation
72+
- When creating a new barnch use the format `agentName-short-description`.
73+
* Example: `jules-auth-token-parsing`
74+
* Example: `gemini-add-storage-file-signer`
75+
76+
77+
## 10. Commit and Pull Request Generation
78+
79+
After implementing and testing a change, you may create a commit and pull request which must follow the following these rules:
80+
81+
### Commit and Pull Request Title Format:
82+
Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification: `type(scope): subject`
83+
- `type` should be one of `feat`, `fix` or `chore`.
84+
- `scope` should be the service package changed (e.g., `auth`, `rtdb`, `deps`).
85+
- **Note**: Some services use specific abbreviations. Use the abbreviation if one exists. Common abbreviations include:
86+
- `messaging` -> `fcm`
87+
- `dataconnect` -> `fdc`
88+
- `database` -> `rtdb`
89+
- `appcheck` -> `fac`
90+
- `subject` should be a brief summary of the change depending on the action:
91+
- For pull requests this should focus on the larger goal the included commits achieve.
92+
- Example: `fix(auth): Resolved issue with custom token verification`
93+
- For commits this should focus on the specific changes made in that commit.
94+
- Example: `fix(auth): Added a new token verification check`
95+
96+
### Commit Body:
97+
This should be a brief explanation of code changes.
98+
99+
Example:
100+
```
101+
feat(fcm): Added `SendEachForMulticast` support for multicast messages
102+
103+
Added a new `SendEachForMulticast` method to the messaging client. This method wraps the `SendEach` method and sends the same message to each token.
104+
```
105+
106+
### Pull Request Body:
107+
- A brief explanation of the problem and the solution.
108+
- A summary of the testing strategy (e.g., "Added a new unit test to verify the fix.").
109+
- A **Context Sources** section that lists the `id` and repository path of every `AGENTS.md` file you used.
110+
111+
Example:
112+
```
113+
feat(fcm): Added support for multicast messages
114+
115+
This change introduces a new `SendEachForMulticast` method to the messaging client, allowing developers to send a single message to multiple tokens efficiently.
116+
117+
Testing: Added unit tests in `messaging_test.go` with a mock server and an integration test in `integration/messaging_test.go`.
118+
119+
Context Sources Used:
120+
- id: firebase-admin-go (`/AGENTS.md`)
121+
```
122+
123+
## 11. Metadata
124+
- id: firebase-admin-go

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ Set up your Firebase project as follows:
148148

149149
2. Enable Firestore:
150150
1. Go to the Firebase Console, and select **Firestore Database** from the **Build** menu.
151-
2. Click on the **Create database** button. You can choose to set up Firestore either in
152-
the production mode or in the test mode.
151+
2. Click on the **Create database** button and create a default database. You can choose
152+
to set up Firestore either in the production mode or in the test mode.
153+
> **Note:** Integration tests are run against both the default database and an additional
154+
database named "testing-database".
155+
3. After the default database is created, click the **Add database** button to create a
156+
second database named "testing-database".
153157

154158

155159
3. Enable Realtime Database:

0 commit comments

Comments
 (0)