@@ -17,13 +17,30 @@ function lernaPublishExitOnFailure {
17
17
# registy URL update changes .yarnrc.yml file
18
18
git update-index --assume-unchanged .yarnrc.yml
19
19
fi
20
-
20
+
21
21
# run lerna publish with the args that were passed to this function
22
22
# duplicate stdout to a temp file
23
23
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code)
24
24
npx lerna publish " $@ " | tee /tmp/publish-results && grep -qvz " lerna ERR!" < /tmp/publish-results
25
25
}
26
26
27
+ # verifies that binaries are uploaded and available before publishing to NPM
28
+ function verifyPkgIsAvailable {
29
+ # exit on failure
30
+ set -e
31
+
32
+ # read version of @aws-amplify/cli
33
+ desiredPkgVersion=$( npx lerna list --scope @aws-amplify/cli --json | jq -r ' .[0].version' )
34
+
35
+ # check binaries
36
+ # send HEAD requests to check for binary presence
37
+ # curl --fail exits with non-zero code and makes this script fail
38
+ curl -I --fail https://package.cli.amplify.aws/$desiredPkgVersion /amplify-pkg-linux-x64.tgz
39
+ curl -I --fail https://package.cli.amplify.aws/$desiredPkgVersion /amplify-pkg-linux-arm64.tgz
40
+ curl -I --fail https://package.cli.amplify.aws/$desiredPkgVersion /amplify-pkg-macos-x64.tgz
41
+ curl -I --fail https://package.cli.amplify.aws/$desiredPkgVersion /amplify-pkg-win-x64.tgz
42
+ }
43
+
27
44
if [ -z " $GITHUB_EMAIL " ]; then
28
45
if [[ " $LOCAL_PUBLISH_TO_LATEST " == " true" ]]; then
29
46
git config --global user.email
[email protected]
@@ -72,6 +89,11 @@ elif [[ "$BRANCH_NAME" == "release" ]]; then
72
89
# create release commit and release tags
73
90
npx lerna version --exact --conventional-commits --conventional-graduate --yes --no-push --include-merged-tags --message " chore(release): Publish latest [ci skip]"
74
91
92
+ if [[ " $LOCAL_PUBLISH_TO_LATEST " != " true" ]]; then
93
+ # verify that binary has been uploaded
94
+ verifyPkgIsAvailable
95
+ fi
96
+
75
97
# publish versions that were just computed
76
98
lernaPublishExitOnFailure from-git --yes --no-push
77
99
@@ -119,6 +141,9 @@ elif [[ "$BRANCH_NAME" =~ ^run-e2e-with-rc\/.* ]] || [[ "$BRANCH_NAME" =~ ^relea
119
141
exit 0
120
142
fi
121
143
144
+ # verify that binary has been uploaded
145
+ verifyPkgIsAvailable
146
+
122
147
# publish versions that were just computed
123
148
lernaPublishExitOnFailure from-git --yes --no-push --dist-tag rc
124
149
0 commit comments