-
-
Save platformsh-devrel/9662f8f82c18ec0c2168185f9f8ccd1d to your computer and use it in GitHub Desktop.
Bitbucket Pipeline file to accompany blog post covering only pushing to Platform.sh when a tag is added
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipelines: | |
tags: | |
'*': | |
- step: | |
clone: | |
depth: full | |
name: Push tag to Platform.sh | |
script: | |
- git fetch --tags | |
- | | |
if [ "${BITBUCKET_TAG}" == "$(git describe --abbrev=0 --tags)" ]; then | |
echo "We need to push this tag. Setting up the Platform CLI Tool..." | |
curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash | |
platform project:set-remote "${PROJID}" | |
echo "Pushing tag ${BITBUCKET_TAG} to Platform.sh..." | |
pshDefaultBranch=$(platform project:info default_branch) | |
platform push "refs/tags/${BITBUCKET_TAG}^{commit}" --target "${pshDefaultBranch}" | |
else | |
echo "Not a tag, or not the latest, so nothing to push. Exiting." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment