@@ -36,10 +36,16 @@ publishPackage() {
36
36
commitAuthorName=$( git --no-pager show -s --format=' %an' HEAD)
37
37
commitAuthorEmail=$( git --no-pager show -s --format=' %ae' HEAD)
38
38
commitMessage=$( git log --oneline -n 1)
39
+ commitTag=" ${buildVersion} -${commitSha} "
39
40
40
41
repoUrl=" https://github.com/angular/${packageRepo} .git"
41
42
repoDir=" tmp/${packageRepo} "
42
43
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
+
43
49
if [[ ! ${COMMAND_ARGS} == * --no-build* ]]; then
44
50
# Create a release of the current repository.
45
51
$( npm bin) /gulp ${packageName} :build-release:clean
@@ -62,7 +68,7 @@ publishPackage() {
62
68
# Replace the version in every file recursively with a more specific version that also includes
63
69
# the SHA of the current build job. Normally this "sed" call would just replace the version
64
70
# placeholder, but the version placeholders have been replaced by the release task already.
65
- sed -i " s/${buildVersion} /${buildVersion} - ${commitSha } /g" $( find . -type f)
71
+ sed -i " s/${buildVersion} /${commitTag } /g" $( find . -type f)
66
72
67
73
# Prepare Git for pushing the artifacts to the repository.
68
74
git config user.name " ${commitAuthorName} "
@@ -73,7 +79,7 @@ publishPackage() {
73
79
74
80
git add -A
75
81
git commit --allow-empty -m " ${commitMessage} "
76
- git tag " ${buildVersion} - ${commitSha }"
82
+ git tag " ${commitTag } "
77
83
git push origin master --tags
78
84
79
85
echo " Published package artifacts for ${packageName} #${commitSha} ."
0 commit comments