Created
March 31, 2025 01:36
-
-
Save boris-42/cb18dc58acaa8c54a7642144fde30e11 to your computer and use it in GitHub Desktop.
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
name: Set Variable to Tag or SHA | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- '**' | |
jobs: | |
set-var: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get tag or commit SHA | |
id: vars | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
else | |
echo "VERSION=${GITHUB_SHA}" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Show VERSION | |
run: echo "Version is ${{ steps.vars.outputs.VERSION }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment