diff --git a/scripts/release/commit-and-tag.sh b/scripts/release/commit-and-tag.sh index 72e9fdb30..a080e5815 100755 --- a/scripts/release/commit-and-tag.sh +++ b/scripts/release/commit-and-tag.sh @@ -4,6 +4,11 @@ set -euo pipefail RELEASE_TAG="v${LD_RELEASE_VERSION}" +tag_exists() ( + git fetch --tags + git rev-parse "${RELEASE_TAG}" >/dev/null 2>&1 +) + echo "Changes staged for release $RELEASE_TAG:" git diff diff --git a/scripts/release/prepare-release.sh b/scripts/release/prepare-release.sh index 4970a6819..a23adacba 100755 --- a/scripts/release/prepare-release.sh +++ b/scripts/release/prepare-release.sh @@ -23,11 +23,6 @@ update_bitbucket() ( sed -i "s#image: launchdarkly/ld-find-code-refs-bitbucket-pipeline:.*#image: launchdarkly/ld-find-code-refs-bitbucket-pipeline:${LD_RELEASE_VERSION}#g" build/metadata/bitbucket/pipe.yml ) -tag_exists() ( - git fetch --tags - git rev-parse "${RELEASE_TAG}" >/dev/null 2>&1 -) - update_go update_orb update_gha diff --git a/scripts/release/publish.sh b/scripts/release/publish.sh index 59d4aca4a..c350fbf38 100755 --- a/scripts/release/publish.sh +++ b/scripts/release/publish.sh @@ -2,12 +2,12 @@ set -euo pipefail -sudo docker login --username ${DOCKER_USERNAME} --password-stdin ${DOCKER_TOKEN} +echo ${DOCKER_TOKEN} | sudo docker login --username ${DOCKER_USERNAME} --password-stdin sudo PATH=${PATH} GITHUB_TOKEN=${GITHUB_TOKEN} make publish # make bitbucket and github known hosts to push successfully -mkdir –m700 ~/.ssh +mkdir -m700 ~/.ssh touch ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts diff --git a/scripts/release/targets/bitbucket.sh b/scripts/release/targets/bitbucket.sh index efdc16ade..1c31dee55 100755 --- a/scripts/release/targets/bitbucket.sh +++ b/scripts/release/targets/bitbucket.sh @@ -25,7 +25,7 @@ publish_bitbucket() ( setup_bitbucket cd bitbucketMetadataUpdates - if git ls-remote --tags origin "refs/tags/v$VERSION" | grep -q "v$VERSION"; then + if git ls-remote --tags origin "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then echo "Version exists; skipping publishing BitBucket Pipe" else echo "Live run: will publish pipe to bitbucket." diff --git a/scripts/release/targets/gha.sh b/scripts/release/targets/gha.sh index 4f229bcc0..74edfcaae 100755 --- a/scripts/release/targets/gha.sh +++ b/scripts/release/targets/gha.sh @@ -39,7 +39,7 @@ clean_up_gha() ( publish_gha() ( setup_gha - if git ls-remote --tags origin "refs/tags/v$VERSION" | grep -q "v$VERSION"; then + if git ls-remote --tags origin "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then echo "Version exists; skipping publishing GHA" else echo "Live run: will publish action to github action marketplace." @@ -51,7 +51,7 @@ publish_gha() ( gh release create $RELEASE_TAG --notes "$RELEASE_NOTES" fi - clean_up + clean_up_gha ) dry_run_gha() (