Skip to content

Commit 277ddfd

Browse files
Merge branch 'main' into a68-schematics-tasks-import
2 parents d88d4d6 + bbce8f0 commit 277ddfd

9 files changed

Lines changed: 720 additions & 48 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,22 @@ jobs:
163163
name: Publish (NPM)
164164
needs: ['build', 'test', 'browser']
165165
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
166-
# One canary publish at a time, so the check below reads the canary the previous one published.
166+
# One npm publish at a time, each held until npm lists it (about 20 minutes at most), so every
167+
# check below reads what the previous publish wrote.
168+
timeout-minutes: 30
167169
concurrency:
168-
group: ${{ github.event_name == 'release' && github.run_id || 'canary-publish' }}
170+
group: npm-publish
169171
cancel-in-progress: false
170172
queue: max
171173
steps:
174+
- name: Checkout the publish scripts
175+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
176+
with:
177+
persist-credentials: false
178+
sparse-checkout: |
179+
tools/publish-job.js
180+
tools/release-tag.js
181+
sparse-checkout-cone-mode: false
172182
- name: Setup node
173183
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
174184
with:
@@ -182,38 +192,27 @@ jobs:
182192
path: dist
183193
- name: Skip a canary that is not newer than npm's
184194
id: canary_check
185-
run: |
186-
VERSION=$(node -p "require('./dist/packages-dist/package.json').version")
187-
if [[ $VERSION == *-canary.* ]]; then
188-
# The dist-tags endpoint is not CDN-cached, unlike the package data `npm view` reads.
189-
DIST_TAGS=$(curl -fsS --retry 3 --max-time 30 https://registry.npmjs.org/-/package/@angular/fire/dist-tags)
190-
NPM_CANARY=$(node -p "JSON.parse(process.argv[1]).canary" "$DIST_TAGS")
191-
# Order by position on main, not by version, which can be higher for an older commit.
192-
git clone --quiet --bare --filter=tree:0 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" history.git
193-
HOW_TO_FIX="Every canary publish fails until the canary dist-tag points at a build of a commit on main. Publish rights are required to fix it with: npm dist-tag add @angular/fire@<version> canary"
194-
if ! NPM_CANARY_COMMIT=$(git -C history.git rev-parse --verify --quiet "${NPM_CANARY##*[.-]}^{commit}"); then
195-
echo "::error::Could not match the canary on npm, $NPM_CANARY, to a single commit in this repository. $HOW_TO_FIX"
196-
exit 1
197-
fi
198-
# `npm publish` always moves a dist-tag, so a canary that is not newer must not publish at all.
199-
if [[ $NPM_CANARY_COMMIT == "$GITHUB_SHA" ]]; then
200-
if [[ $VERSION == "$NPM_CANARY" ]]; then
201-
echo "::notice::Not publishing $VERSION, because it is already the canary on npm."
202-
echo "skip=true" >> "$GITHUB_OUTPUT"
203-
fi
204-
elif git -C history.git merge-base --is-ancestor "$GITHUB_SHA" "$NPM_CANARY_COMMIT"; then
205-
echo "::warning::Not publishing $VERSION, because the canary on npm, $NPM_CANARY, is from a later commit on main."
206-
echo "skip=true" >> "$GITHUB_OUTPUT"
207-
elif ! git -C history.git merge-base --is-ancestor "$NPM_CANARY_COMMIT" "$GITHUB_SHA"; then
208-
echo "::error::Not publishing $VERSION, because its commit and the commit of the canary on npm, $NPM_CANARY, are not on the same line of history. One of them is not on main. $HOW_TO_FIX"
209-
exit 1
210-
fi
211-
fi
195+
if: github.event_name != 'release'
196+
run: node tools/publish-job.js canary-check
197+
- name: Choose the release's dist-tag
198+
id: release_tag
199+
if: github.event_name == 'release'
200+
run: node tools/publish-job.js release-tag
212201
- name: Publish
213-
if: steps.canary_check.outputs.skip != 'true'
214-
run: |
215-
cd ./dist/packages-dist
216-
chmod +x publish.sh
217-
./publish.sh
202+
id: publish
203+
if: steps.canary_check.outputs.skip != 'true' && steps.release_tag.outputs.published != 'true'
204+
run: npm publish ./dist/packages-dist --access public --registry https://wombat-dressing-room.appspot.com --tag "$NPM_TAG"
205+
env:
206+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
207+
NPM_TAG: ${{ steps.release_tag.outputs.tag || 'canary' }}
208+
- name: Wait for npm to list the version
209+
id: wait
210+
if: steps.publish.outcome == 'success' || steps.release_tag.outputs.published == 'true'
211+
run: node tools/publish-job.js wait "$NPM_TAG"
212+
env:
213+
NPM_TAG: ${{ steps.release_tag.outputs.tag || 'canary' }}
214+
- name: Move next up to the release
215+
if: steps.wait.outputs.listed == 'true' && steps.release_tag.outputs.tag == 'latest'
216+
run: node tools/publish-job.js move-next
218217
env:
219218
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ coverage
2121
api-*.json
2222
angularfire.tgz
2323
unpack.sh
24-
publish.sh
2524
.firebase
2625
.angular
2726
.vscode

‎.npmignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*.spec.*
22
test-config.*
3-
publish.sh
43
__ivy_ngcc__/
54
*.min.js
65
*.min.js.map

‎src/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@
3131
"@angular/common": "^21.2.0",
3232
"@angular/core": "^21.2.0",
3333
"@angular/platform-browser": "^21.2.0",
34-
"@angular/platform-server": "^21.2.0",
3534
"rxjs": "~7.8.0",
3635
"firebase-tools": "^14.0.0 || ^15.0.0",
3736
"typescript": ">=5.8 <6.0"
3837
},
3938
"peerDependenciesMeta": {
4039
"firebase-tools": { "optional": true },
41-
"@angular/platform-server": { "optional": true },
4240
"typescript": { "optional": true }
4341
},
4442
"dependencies": {

‎tools/build.sh‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
TAG_TEST="^refs/tags/.+$"
2-
LATEST_TEST="^[^-]*$"
32

43
if [[ $GITHUB_REF =~ $TAG_TEST ]]; then
54
OVERRIDE_VERSION=${GITHUB_REF/refs\/tags\//}
6-
if [[ $OVERRIDE_VERSION =~ $LATEST_TEST ]]; then
7-
NPM_TAG=latest
8-
else
9-
NPM_TAG=next
10-
fi;
115
else
126
PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)")
137
if ! PUBLISHED_VERSIONS=$(npm view @angular/fire versions --json); then
@@ -18,11 +12,8 @@ else
1812
# `sha-` stops npm dropping an all-digit sha's leading zero.
1913
CANARY_ID=$(TZ=UTC git show -s --date=format-local:%Y%m%d%H%M%S --format=%cd.sha-%h $GITHUB_SHA)
2014
OVERRIDE_VERSION=$BASE_VERSION-canary.$CANARY_ID
21-
NPM_TAG=canary
2215
fi;
2316

2417
npm --no-git-tag-version --allow-same-version -f version $OVERRIDE_VERSION
2518

26-
npm run build &&
27-
echo "npm publish . --access public --registry https://wombat-dressing-room.appspot.com --tag $NPM_TAG" > ./dist/packages-dist/publish.sh &&
28-
chmod +x ./dist/packages-dist/publish.sh
19+
npm run build

0 commit comments

Comments
 (0)