Skip to content
at-sign

GitHub Action

Get Tag or SHA

v2 Latest version

Get Tag or SHA

at-sign

Get Tag or SHA

Gets the release name if it exists otherwise returns the commit id

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Get Tag or SHA

uses: tenhaus/get-release-or-tag@v2

Learn more about this action in tenhaus/get-release-or-tag

Choose a version

Get release name or commit id

A simple action to help release docker images in a dev/prod pipeline. It will return the release name ($GITHUB_REF without refs/tags/) if the action is release otherwise it will return $GITHUB_SHA

Ex:

name: Publish
on: [pull_request, release]
jobs:
  build_docker_image:
    name: Flyway
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: tenhaus/get-release-or-tag@v2
        id: tag

      - name: Build
        run: docker build src/flyway -t your.docker.repo/flyway:${{ steps.tag.outputs.tag }}

      - name: Push
        run: docker push your.docker.repo/flyway:${{ steps.tag.outputs.tag }}