From 426f11fb13420f96fa0ea49b936dc1975c9172c2 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 7 Dec 2017 00:40:56 +0100 Subject: [PATCH] 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. --- scripts/deploy/publish-build-artifacts.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/deploy/publish-build-artifacts.sh b/scripts/deploy/publish-build-artifacts.sh index 15e0de775c2..5aa563b2971 100755 --- a/scripts/deploy/publish-build-artifacts.sh +++ b/scripts/deploy/publish-build-artifacts.sh @@ -41,11 +41,6 @@ publishPackage() { repoUrl="https://github.com/angular/${packageRepo}.git" repoDir="tmp/${packageRepo}" - if [[ $(git rev-parse -q --verify "refs/tags/${commitTag}") ]]; then - echo "Skipping publish because tag is already published" - exit 0 - fi - if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then # Create a release of the current repository. $(npm bin)/gulp ${packageName}:build-release:clean @@ -65,6 +60,11 @@ publishPackage() { # Create the build commit and push the changes to the repository. cd ${repoDir} + if [[ $(git ls-remote origin "refs/tags/${commitTag}") ]]; then + echo "Skipping publish because tag is already published" + exit 0 + fi + # Replace the version in every file recursively with a more specific version that also includes # the SHA of the current build job. Normally this "sed" call would just replace the version # placeholder, but the version placeholders have been replaced by the release task already.