mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: skip artifact publish if tag already exists (#8720)
* No longer errors the deployment if the artifacts have been published already. (e.g. Job restart)
This commit is contained in:
committed by
mmalerba
parent
03b7e846e7
commit
826394bba9
@@ -36,10 +36,16 @@ publishPackage() {
|
||||
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)
|
||||
commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)
|
||||
commitMessage=$(git log --oneline -n 1)
|
||||
commitTag="${buildVersion}-${commitSha}"
|
||||
|
||||
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
|
||||
@@ -62,7 +68,7 @@ publishPackage() {
|
||||
# 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.
|
||||
sed -i "s/${buildVersion}/${buildVersion}-${commitSha}/g" $(find . -type f)
|
||||
sed -i "s/${buildVersion}/${commitTag}/g" $(find . -type f)
|
||||
|
||||
# Prepare Git for pushing the artifacts to the repository.
|
||||
git config user.name "${commitAuthorName}"
|
||||
@@ -73,7 +79,7 @@ publishPackage() {
|
||||
|
||||
git add -A
|
||||
git commit --allow-empty -m "${commitMessage}"
|
||||
git tag "${buildVersion}-${commitSha}"
|
||||
git tag "${commitTag}"
|
||||
git push origin master --tags
|
||||
|
||||
echo "Published package artifacts for ${packageName}#${commitSha}."
|
||||
|
||||
Reference in New Issue
Block a user