You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eee3486
Browse filesBrowse the repository at this point in the historyBrowse files
fix(ci): keep the canary dist-tag from moving back to an older build (#3784)
Every canary publish moved the `canary` dist-tag, whatever commit it
was built from. Two merges close together could publish out of order,
and a re-run of an older run could publish its build last.
The publish job now clones the repository's commit history and
publishes a canary only when its commit comes after the commit of the
canary on npm, or is the same commit under a new version. A build of
an earlier commit is skipped with a warning. Commits are compared
rather than versions, because a version can be higher for an older
commit.
Canary publishes also run one at a time, queued, so each check reads
what the previous publish left on npm. Release publishes are unchanged.
A scheduled run on an unchanged main now skips with a notice instead
of failing on the duplicate version.
Fixes#3783
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"
0 commit comments