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

bin/filter has been removed, how do we accomplish that functionality now?

Solved! Go to Solution.

We have a collection of actions that deploy to different environment based on pattern matching the tag, and so far as I've been able to find, the new filtering functionality is not as capable

 

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

So far as I've been able to figure out, you can't do wildcard filtering like we need

 

args: tag v*.*.*-alpha.*
args: tag v*.*.*-beta.*
args: tag v*.*.*-staging.*
args: not tag v*.*.*-*.*

Is there a way to accomplish this kind of filtering now?

Any suggestions for what we can do?

 

 

Here is a full example of our deploy script in case that matters

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
      -
        uses: actions/setup-node@v1
        with:
          version: 12
          registry-url: 'https://registry.npmjs.org/'
      -
        name: 'NPM Install'
        run: 'npm clean-install'
        env:
          NODE_AUTH_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'
      -
        name: 'NPM Build'
        run: 'npm run build'
        env:
          REACT_APP_ENV: beta
      -
        name: 'Sync to AWS'
        uses: actions/aws/cli@master
        env:
          AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
        with:
          args: 's3 sync build/ s3://{S3_BUCKET_HERE}'

  announce_start:
    needs:
      - filter
    name: 'deploy:beta:announce-start'
    runs-on: ubuntu-latest
    steps:
      -
        name: 'deploy:beta:announce-start:slack-post'
        uses: Ilshidur/action-slack@master
        env:
          REACT_APP_ENV: beta
          SLACK_CHANNEL: web-app-deployments
          SLACK_OVERRIDE_MESSAGE: 'true'
          SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
        with:
          args: |

            _Automated Deploy Started by {{ GITHUB_ACTOR }}_"
            • *Environment:* `{{ REACT_APP_ENV }}`
            • *Repository:* `{{ GITHUB_REPOSITORY }}`
            • *Reference:* `{{ GITHUB_REF }}`

  announce_completion:
    needs:
      - announce_start
      - build
    name: 'deploy:beta:announce-completion'
    runs-on: ubuntu-latest
    steps:
      -
        name: 'deploy:beta:announce-completion:slack-post'
        uses: Ilshidur/action-slack@master
        env:
          REACT_APP_ENV: beta
          SLACK_CHANNEL: web-app-deployments
          SLACK_OVERRIDE_MESSAGE: 'true'
          SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
        with:
          args: |

            _Automated Deploy Complete_
            • *Environment:* `{{ REACT_APP_ENV }}`
2 Replies
Highlighted
Copilot Lvl 3
Message 2 of 3

Re: bin/filter has been removed, how do we accomplish that functionality now?

It looks like the filtering functionality was expanded very recently

 

https://github.blog/changelog/2019-09-30-github-actions-event-filtering-updates

https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

 

Fingers crossed it will accomplish what we're looking for now.

Solution
Copilot Lvl 3
Message 3 of 3

Re: bin/filter has been removed, how do we accomplish that functionality now?

The new filter functionality seems to be working fine, just had to switch from on:create to on:push

 

Here's a full script for posterity

 

name: 'deploy:beta'

on:
  push:
    tags:
      - 'v20[0-9][0-9].[0-9]+.[0-9]+-beta.[0-9]+'

env:
  REACT_APP_ENV: beta

jobs:
  build:
    name: 'deploy:beta:build'
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/checkout@v1
        with:
          fetch-depth: 1
      -
        uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: 'https://registry.npmjs.org/'
      -
        name: 'NPM Install'
        run: 'npm clean-install'
        env:
          NODE_AUTH_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'
      -
        name: 'NPM Build'
        run: 'npm run build'
      -
        name: 'Sync to AWS'
        uses: actions/aws/cli@master
        env:
          AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
        with:
          args: 's3 sync build/ s3://S3_BUCKET_HERE'

  announce_start:
    name: 'deploy:beta:announce-start'
    runs-on: ubuntu-latest
    steps:
      -
        name: 'deploy:beta:announce-start:slack-post'
        uses: Ilshidur/action-slack@master
        env:
          SLACK_CHANNEL: web-app-deployments
          SLACK_OVERRIDE_MESSAGE: 'true'
          SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
        with:
          args: |

            _Automated Deploy Started by {{ GITHUB_ACTOR }}_"
            • *Environment:* `{{ REACT_APP_ENV }}`
            • *Repository:* `{{ GITHUB_REPOSITORY }}`
            • *Reference:* `{{ GITHUB_REF }}`

  announce_completion:
    needs:
      - announce_start
      - build
    name: 'deploy:beta:announce-completion'
    runs-on: ubuntu-latest
    steps:
      -
        name: 'deploy:beta:announce-completion:slack-post'
        uses: Ilshidur/action-slack@master
        env:
          SLACK_CHANNEL: web-app-deployments
          SLACK_OVERRIDE_MESSAGE: 'true'
          SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
        with:
          args: |

            _Automated Deploy Complete_
            • *Environment:* `{{ REACT_APP_ENV }}`

The Production variation uses

 

on:
  push:
    tags:
      - 'v20[0-9][0-9].[0-9]+.[0-9]+.'