Github action to get the release tag if it exists, otherwise returns the commit id (SHA).
Supported runners: ubuntu
, macos
, windows
steps:
- uses: actions/checkout@v3
- id: tag
uses: GuillaumeFalourd/get-release-or-tag@v2
- name: TAG
run: echo "TAG ${{ steps.tag.outputs.tag }}"
This action can for example helps you get 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
name: Publish
on:
release:
types:
- published
jobs:
build_docker_image:
name: Flyway
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: GuillaumeFalourd/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 }}
Field | How to access | Observation |
---|---|---|
tag | ${{ steps.<step-id>.outputs.tag }} |
Contains last release tag or SHA |
☞ This repository uses the Apache License 2.0