Start a github workflow on a tag name and build based on that specific tag

I want to start my workflow on tags that contains the value “buildRelease” so I’m using ‘*buildRelease*’, in practice the branch name would be something like “2.0.1-buildRelease”, “2.0.2-buildRelease”, how do I specify in the workflow config that I want to build with the code base of “2.0.2-buildRelease” and not the latest image of the code.

on:
push:
tags:
-'\*buildRelease\*'

I’m checking out the project like this: 

-uses: actions/checkout@v1
with:
ref:'branch-name'

So instead of “branch-name” I want to point to the tag name that triggered the workflow.

Any idea?

Hi @oth-libs ,

Please used the following syntax to specify the tag ‘2.0.2-buildRelease’ for checkout action in the workflow run.

- uses: actions/checkout@v1
   with:
     ref: refs/tags/2.0.2-buildRelease
1 Like

Thanks @brightran , but I just figured out what I needed. it was actually more like this: 

on:
  push:
    tags:
      - '*productionDebug*'
..
..

      - name: Get tag name
        id: get_tag_name
        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
      - uses: actions/checkout@v1
        with:
          ref: ${{ steps.get_tag_name.outputs.VERSION }}

so I wanted to trigger the build with a tag containing a keyword and then building based on that whole tag name, while keeping it generic.

cheers

2 Likes