Skip to content

Commit 1dc160f

Browse files
author
GitHub Actions Bot
committed
Merge branch 'master' into release
2 parents 3d87d2e + cadc804 commit 1dc160f

File tree

5 files changed

+164
-39
lines changed

5 files changed

+164
-39
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
* @allspain @hsubox76 @firebase/jssdk-global-approvers
3636

3737
# Database Code
38-
packages/database @schmidt-sebastian @jsdt @firebase/jssdk-global-approvers
39-
packages/database-compat @schmidt-sebastian @jsdt @firebase/jssdk-global-approvers
40-
packages/database-types @schmidt-sebastian @jsdt @firebase/jssdk-global-approvers
38+
packages/database @maneesht @jsdt @firebase/jssdk-global-approvers
39+
packages/database-compat @maneesht @jsdt @firebase/jssdk-global-approvers
40+
packages/database-types @maneesht @jsdt @firebase/jssdk-global-approvers
4141

4242
# Firestore Code
4343
packages/firestore @firebase/firestore-js-team @firebase/jssdk-global-approvers
@@ -47,9 +47,9 @@ packages/firestore-types @firebase/firestore-js-team @firebase/jssdk-global-app
4747
integration/firestore @firebase/firestore-js-team @firebase/jssdk-global-approvers
4848

4949
# Storage Code
50-
packages/storage @schmidt-sebastian @firebase/jssdk-global-approvers
51-
packages/storage-compat @schmidt-sebastian @firebase/jssdk-global-approvers
52-
packages/storage-types @schmidt-sebastian @firebase/jssdk-global-approvers
50+
packages/storage @maneesht @tonyjhuang @firebase/jssdk-global-approvers
51+
packages/storage-compat @maneesht @tonyjhuang @firebase/jssdk-global-approvers
52+
packages/storage-types @maneesht @tonyjhuang @firebase/jssdk-global-approvers
5353

5454
# Messaging Code
5555
packages/messaging @zwu52 @firebase/jssdk-global-approvers

.github/workflows/release-prod.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Production Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
deploy:
7+
name: Production Release
8+
runs-on: ubuntu-latest
9+
# Allow GITHUB_TOKEN to have write permissions
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Set up Node (14)
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 14.x
18+
- name: Checkout release branch (with history)
19+
uses: actions/checkout@master
20+
with:
21+
# Release script requires git history and tags.
22+
fetch-depth: 0
23+
ref: release
24+
- name: Yarn install
25+
run: yarn
26+
- name: Publish to NPM
27+
# --skipTests No need to run tests
28+
# --skipReinstall Yarn install has already been run
29+
# --ignoreUnstaged Adding the @firebase/app changeset file means
30+
# there's unstaged changes. Ignore.
31+
# TODO: Make these flags defaults in the release script.
32+
run: yarn release --releaseType Production --ci --skipTests --skipReinstall --ignoreUnstaged
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
NPM_TOKEN_ANALYTICS: ${{secrets.NPM_TOKEN_ANALYTICS}}
36+
NPM_TOKEN_ANALYTICS_INTEROP_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_INTEROP_TYPES}}
37+
NPM_TOKEN_ANALYTICS_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_TYPES}}
38+
NPM_TOKEN_APP: ${{secrets.NPM_TOKEN_APP}}
39+
NPM_TOKEN_APP_TYPES: ${{secrets.NPM_TOKEN_APP_TYPES}}
40+
NPM_TOKEN_APP_CHECK: ${{secrets.NPM_TOKEN_APP_CHECK}}
41+
NPM_TOKEN_APP_CHECK_INTEROP_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_INTEROP_TYPES}}
42+
NPM_TOKEN_APP_CHECK_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_TYPES}}
43+
NPM_TOKEN_AUTH: ${{secrets.NPM_TOKEN_AUTH}}
44+
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
45+
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
46+
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
47+
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
48+
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
49+
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
50+
NPM_TOKEN_FIRESTORE_TYPES: ${{secrets.NPM_TOKEN_FIRESTORE_TYPES}}
51+
NPM_TOKEN_FUNCTIONS: ${{secrets.NPM_TOKEN_FUNCTIONS}}
52+
NPM_TOKEN_FUNCTIONS_TYPES: ${{secrets.NPM_TOKEN_FUNCTIONS_TYPES}}
53+
NPM_TOKEN_INSTALLATIONS: ${{secrets.NPM_TOKEN_INSTALLATIONS}}
54+
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
55+
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
56+
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
57+
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
58+
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
59+
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
60+
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
61+
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
62+
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
63+
NPM_TOKEN_RULES_UNIT_TESTING: ${{secrets.NPM_TOKEN_RULES_UNIT_TESTING}}
64+
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
65+
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
66+
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
67+
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
68+
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
69+
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
70+
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}
71+
NPM_TOKEN_INSTALLATIONS_COMPAT: ${{ secrets.NPM_TOKEN_INSTALLATIONS_COMPAT }}
72+
NPM_TOKEN_ANALYTICS_COMPAT: ${{ secrets.NPM_TOKEN_ANALYTICS_COMPAT }}
73+
NPM_TOKEN_AUTH_COMPAT: ${{ secrets.NPM_TOKEN_AUTH_COMPAT }}
74+
NPM_TOKEN_MESSAGING_INTEROP_TYPES: ${{ secrets.NPM_TOKEN_MESSAGING_INTEROP_TYPES }}
75+
NPM_TOKEN_FUNCTIONS_COMPAT: ${{ secrets.NPM_TOKEN_FUNCTIONS_COMPAT }}
76+
NPM_TOKEN_MESSAGING_COMPAT: ${{ secrets.NPM_TOKEN_MESSAGING_COMPAT }}
77+
NPM_TOKEN_PERFORMANCE_COMPAT: ${{ secrets.NPM_TOKEN_PERFORMANCE_COMPAT }}
78+
NPM_TOKEN_REMOTE_CONFIG_COMPAT: ${{ secrets.NPM_TOKEN_REMOTE_CONFIG_COMPAT }}
79+
NPM_TOKEN_DATABASE_COMPAT: ${{ secrets.NPM_TOKEN_DATABASE_COMPAT }}
80+
NPM_TOKEN_FIRESTORE_COMPAT: ${{ secrets.NPM_TOKEN_FIRESTORE_COMPAT }}
81+
NPM_TOKEN_STORAGE_COMPAT: ${{ secrets.NPM_TOKEN_STORAGE_COMPAT }}
82+
NPM_TOKEN_APP_CHECK_COMPAT: ${{ secrets.NPM_TOKEN_APP_CHECK_COMPAT }}
83+
NPM_TOKEN_API_DOCUMENTER: ${{ secrets.NPM_TOKEN_API_DOCUMENTER }}
84+
CI: true
85+
- name: Get release version
86+
id: get-version
87+
# In production, there is only one version number
88+
run: |
89+
VERSION_SCRIPT="const pkg = require('./packages/firebase/package.json'); console.log(pkg.version);"
90+
VERSION=`node -e "${VERSION_SCRIPT}"`
91+
echo "::set-output name=BASE_VERSION::$VERSION"
92+
- name: Echo version in shell
93+
run: |
94+
echo "Base version: ${{ steps.get-version.outputs.BASE_VERSION }}"
95+
- name: Log to release tracker
96+
# Sends release information to cloud functions endpoint of release tracker.
97+
run: |
98+
DATE=$(date +'%m/%d/%Y')
99+
BASE_VERSION=${{ steps.get-version.outputs.BASE_VERSION }}
100+
RELEASE_TRACKER_URL=${{ secrets.RELEASE_TRACKER_URL }}
101+
curl -X POST -H "Content-Type:application/json" \
102+
-d "{\"version\":\"$BASE_VERSION\",\"date\":\"$DATE\"}" \
103+
$RELEASE_TRACKER_URL/logProduction

packages/firestore/src/local/query_engine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class QueryEngine {
154154
return null;
155155
}
156156

157-
if (indexType === IndexType.PARTIAL) {
157+
if (query.limit !== null && indexType === IndexType.PARTIAL) {
158158
// We cannot apply a limit for targets that are served using a partial
159159
// index. If a partial index will be used to serve the target, the
160160
// query may return a superset of documents that match the target
@@ -301,7 +301,7 @@ export class QueryEngine {
301301
* Determines if a limit query needs to be refilled from cache, making it
302302
* ineligible for index-free execution.
303303
*
304-
* @param query The query.
304+
* @param query - The query.
305305
* @param sortedPreviousResults - The documents that matched the query when it
306306
* was last synchronized, sorted by the query's comparator.
307307
* @param remoteKeys - The document keys that matched the query at the last

scripts/release/release.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { reinstallDeps, buildPackages } from './utils/yarn';
2727
import { runTests, setupTestDeps } from './utils/tests';
2828
import { bumpVersionForStaging } from './staging';
2929
import { ReleaseType } from './utils/enums';
30+
import { getAllPackages } from './utils/workspace';
3031
const prompt = createPromptModule();
3132

3233
interface releaseOptions {
@@ -94,12 +95,11 @@ export async function runRelease({
9495
console.log(`Publishing ${inputReleaseType} release.`);
9596

9697
let packagesToPublish = [];
97-
98-
/**
99-
* Bump versions for staging release
100-
* NOTE: For prod, versions are bumped in a PR which should be merged before running this script
101-
*/
10298
if (releaseType === ReleaseType.Staging) {
99+
/**
100+
* Bump versions for staging release
101+
* NOTE: For prod, versions are bumped in a PR which should be merged before running this script
102+
*/
103103
const updatedPackages = await bumpVersionForStaging();
104104

105105
if (!ci) {
@@ -117,6 +117,13 @@ export async function runRelease({
117117
for (const key of updatedPackages.keys()) {
118118
packagesToPublish.push(key);
119119
}
120+
} else {
121+
/**
122+
* For production releases, pass all packages to publishToCI().
123+
* It will only publish if it finds the local version is newer
124+
* than NPM's.
125+
*/
126+
packagesToPublish = await getAllPackages();
120127
}
121128

122129
/**

scripts/release/utils/publish.ts

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,49 @@ export async function publishInCI(
4242
npmTag: string,
4343
dryRun: boolean
4444
) {
45-
const taskArray = await Promise.all(
46-
updatedPkgs.map(async pkg => {
47-
const path = await mapPkgNameToPkgPath(pkg);
48-
49-
/**
50-
* Can't require here because we have a cached version of the required JSON
51-
* in memory and it doesn't contain the updates
52-
*/
53-
const { version, private: isPrivate } = JSON.parse(
54-
await readFile(`${path}/package.json`, 'utf8')
55-
);
56-
57-
/**
58-
* Skip private packages
59-
*/
60-
if (isPrivate) {
61-
return {
62-
title: `Skipping private package: ${pkg}.`,
63-
task: () => {}
64-
};
45+
const taskArray = [];
46+
for (const pkg of updatedPkgs) {
47+
const path = await mapPkgNameToPkgPath(pkg);
48+
49+
/**
50+
* Can't require here because we have a cached version of the required JSON
51+
* in memory and it doesn't contain the updates
52+
*/
53+
const { version, private: isPrivate } = JSON.parse(
54+
await readFile(`${path}/package.json`, 'utf8')
55+
);
56+
57+
/**
58+
* Skip private packages
59+
*/
60+
if (isPrivate) {
61+
console.log(`Skipping private package: ${pkg}.`);
62+
continue;
63+
}
64+
65+
/**
66+
* Skip if this version has already been published.
67+
*/
68+
try {
69+
const { stdout: npmVersion } = await exec(`npm info ${pkg} version`);
70+
if (version === npmVersion.trim()) {
71+
console.log(
72+
`Skipping publish of ${pkg} - version ${version} is already published`
73+
);
74+
continue;
6575
}
76+
} catch (e) {
77+
// 404 from NPM indicates the package doesn't exist there.
78+
console.log(`Skipping pkg: ${pkg} - it has never been published to NPM.`);
79+
continue;
80+
}
81+
82+
taskArray.push({
83+
title: `📦 ${pkg}@${version}`,
84+
task: () => publishPackageInCI(pkg, npmTag, dryRun)
85+
});
86+
}
6687

67-
return {
68-
title: `📦 ${pkg}@${version}`,
69-
task: () => publishPackageInCI(pkg, npmTag, dryRun)
70-
};
71-
})
72-
);
7388
const tasks = new Listr(taskArray, {
7489
concurrent: false,
7590
exitOnError: false

0 commit comments

Comments
 (0)