Skip to content

Instantly share code, notes, and snippets.

@skalahonza
Created February 17, 2023 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skalahonza/26a50586b13c6d6b95966fcff8a2aaa9 to your computer and use it in GitHub Desktop.
Save skalahonza/26a50586b13c6d6b95966fcff8a2aaa9 to your computer and use it in GitHub Desktop.
This script is designed to be used in GitHub Actions workflows to set version-related environment variables based on the event that triggered the workflow. If the workflow was triggered by a tag event, the script sets the RELEASE_VERSION environment variable to the commit SHA and tag name separated by a semicolon. Otherwise, the RELEASE_VERSION …
- name: Set Release Version
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
echo "RELEASE_VERSION=${GITHUB_SHA};${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${GITHUB_SHA}" >> $GITHUB_ENV
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment