Giter VIP home page Giter VIP logo

get-tag's Introduction

Get tag name

This action gets tag name from commit that triggered the action and puts it into an environment variable GIT_TAG_NAME. It will also export is as an output named "tag".

You can also use optional parameters tagRegex and tagRegexGroup to extract a part from tag string.

Usage

Dead simple:

    steps:
      - uses: olegtarasov/[email protected]
        id: tagName
        with:
          tagRegex: "foobar-(.*)"  # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
          tagRegexGroup: 1 # Optional. Default is 1.
      - name: Some other step # Output usage example
        with:
          tagname: ${{ steps.tagName.outputs.tag }}
      - name: Yet another step # Environment variabl usage example
        run: |
          docker build . --file Dockerfile --tag docker.pkg.github.com/someimage:$GIT_TAG_NAME

You can also use named regex groups (thanks to PR from @jelgblad):

    steps:
      - uses: olegtarasov/[email protected]
        id: tagName
        with:
          tagRegex: "(?<package>.*)-(?<version>.*)" 
      - name: Some other step # Output usage example
        with:
          dirname: ${{ steps.tagName.outputs.package }}
          tagname: ${{ steps.tagName.outputs.version }}

get-tag's People

Contributors

bryanmacfarlane avatar covertbert avatar dependabot[bot] avatar estrada9166 avatar foolip avatar gowee avatar hashtagchris avatar heroiceric avatar hross avatar iamhughes avatar jackton1 avatar jasonetco avatar jasonkarns avatar jelgblad avatar jj avatar joshmgross avatar kengotoda avatar logerfo avatar mscoutermarsh avatar olegtarasov avatar omarabid avatar potato4d avatar rferro avatar shawnnapora avatar singingwolfboy avatar svenstaro avatar thboop avatar tingluohuang avatar vtbassmatt avatar yamboy1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

get-tag's Issues

Error: Unable to process command '##[set-env name=GIT_TAG_NAME;]stage-v1' successfully.

Using

 - name: Get tag name
        uses: olegtarasov/get-tag@v2

fails with

Error: Unable to process command '##[set-env name=GIT_TAG_NAME;]stage-v1' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

set-env deprecation warning

Looks like this action is triggering the following warning:

Warning: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Maybe just a matter of updating deps?

Specify expected inputs in action.yml

Thanks for creating this action! It's very useful when you want to get tag name on all 3 major operating systems.

When using this action, I've noticed that it produces warning:

##[warning]Unexpected input(s) 'tagRegex', 'tagRegexGroup', valid inputs are ['']

Most likely the reason for this is that action.yml file specifies only outputs but not inputs. I believe, if you specify inputs, the warning will disappear.

I found some docs on action inputs:

Null output...

So, just trying this for the first time. There is no output.

feature request: option to strip leading `v`

It's pretty common for git tags to have a leading v prefix on the version number. However, it's equally common (and in the case of needing this very action, I'd say exceedingly likely) that one may need or prefer the version name without the leading v.

It would be great if there were an option (default to whatever makes sense to you) that would automatically strip any leading v when returning the tag name.

Latest version tag missing 'v'

Hello!

This workflow broke for me today when I updated it. I realized it was because I updated it to v2.1.3, but your latest tag is just 2.1.3.

When you have time, can you please create a new release tag to match github actions patterns and your old tags?

Thank you for you work on this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.