Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 3

[GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

I have two git tag forms v/release/1.0.0 and v/beta/1.0.0, with following two workflow define:

 

on:
  create:
    tags:
      - v/release/*

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu

    steps:
      run: npm publish --tag=latest

 

and

 

on:
  create:
    tags:
      - v/beta/*

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu

    steps:
      run: npm publish --tag=next

 

I would expect the two workflows isolated by its tag filters, but seems not, am I doing it wrong?

 

2 Replies
Ground Controller Lvl 1
Message 2 of 3

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

I've been struggling to figure how how to filter by tags as well, but so far as I can tell, wildcarding just doesn't work at all against tags :scream:

 

I've been trying variations of 

on:
  create:
    tags:
      - v*.*.*-beta.*

Every tag push is triggering all our different environments though, I can't figure out the right way to do it.

Ground Controller Lvl 1
Message 3 of 3

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

It looks like we're going to have to use the old style bin/filter to get tag filtering work like we're wanting. It's just a shame to spin up all those unneccessary instances just to filter against a tag

 

name: 'deploy:beta'
on:
  create:
    tags:
      - v*.*.*-beta.*
    branches:
      - 'refs/tags/*'
      - '!refs/heads/*'

jobs:
  filter:
    name: 'deploy:beta:filter'
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/bin/filter@master
        with:
          args: tag v*.*.*-beta.*

  build:
    needs:
      - filter
    name: 'deploy:beta:build'
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/checkout@v1
        with:
          fetch-depth: 1
...

Hopefully someone else can chime in and explain how to do it better