action.yml 692 B

12345678910111213141516171819202122
  1. name: "Determine tag name"
  2. description: "Determine the tag name to use for a release"
  3. outputs:
  4. name:
  5. description: "The name of the tag"
  6. value: ${{ steps.tag.outputs.name }}
  7. runs:
  8. using: "composite"
  9. steps:
  10. - name: Determine tag name
  11. id: tag
  12. shell: bash
  13. run: |
  14. BUILD_NUMBER="$(git rev-list --count HEAD)"
  15. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  16. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  17. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  18. else
  19. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  20. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  21. fi