Skip to content

Commit 426f11f

Browse files
devversionmmalerba
authored andcommitted
chore: better tag check in publish-artifacts script (#8852)
Currently the publish-artifacts script checks for the tag in the local repository copy. Since the builds repository will be cloned with a depth of `1`, the tags aren't being checked properly. To be more sure about the tag existence, the `git ls-remote` command can be used.
1 parent cb2eac2 commit 426f11f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/deploy/publish-build-artifacts.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ publishPackage() {
4141
repoUrl="https://github.com/angular/${packageRepo}.git"
4242
repoDir="tmp/${packageRepo}"
4343

44-
if [[ $(git rev-parse -q --verify "refs/tags/${commitTag}") ]]; then
45-
echo "Skipping publish because tag is already published"
46-
exit 0
47-
fi
48-
4944
if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then
5045
# Create a release of the current repository.
5146
$(npm bin)/gulp ${packageName}:build-release:clean
@@ -65,6 +60,11 @@ publishPackage() {
6560
# Create the build commit and push the changes to the repository.
6661
cd ${repoDir}
6762

63+
if [[ $(git ls-remote origin "refs/tags/${commitTag}") ]]; then
64+
echo "Skipping publish because tag is already published"
65+
exit 0
66+
fi
67+
6868
# Replace the version in every file recursively with a more specific version that also includes
6969
# the SHA of the current build job. Normally this "sed" call would just replace the version
7070
# placeholder, but the version placeholders have been replaced by the release task already.

0 commit comments

Comments
 (0)