Skip to content

Instantly share code, notes, and snippets.

@platformsh-devrel
Created April 1, 2024 20:31
Show Gist options
  • Save platformsh-devrel/9662f8f82c18ec0c2168185f9f8ccd1d to your computer and use it in GitHub Desktop.
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
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