This action returns the valid docker image tag name by extracting the branch from branch or tag ref and replacing /
by -
using Shell Parameter Expansion
refs/heads/feature/add-new-action -> feature-add-new-action
refs/tags/1.0.0 -> 1.0.0
refs/heads/master -> latest
Required The name of the branch or tag ref. Default is the current branch that runs this action.
The valid branch tag
The valid branch tag
uses: nimblehq/branch-tag-action@v1
# or
uses: nimblehq/branch-tag-action@v1
with:
ref: 'feature/add-new-action'
on: [push]
jobs:
print_branch_tag:
runs-on: ubuntu-latest
name: A job to print branch tag
steps:
- uses: actions/checkout@v2
- uses: nimblehq/branch-tag-action@v1
id: extract
# Use the output/env from the `extract` step
- name: Print the values
run: |
echo "The branch tag is ${{ steps.extract.outputs.branch_tag }}"
echo "or ${{ env.BRANCH_TAG }}"
This project is Copyright (c) 2014-2020 Nimble. It is free software, and may be redistributed under the terms specified in the LICENSE file.
This project is maintained and funded by Nimble.
We love open source and do our part in sharing our work with the community! See our other projects or hire our team to help build your product.