Release after PR Merge

Good day! I’m in the process of slowly moving my CI/CD pipeline from Travis to github actions. I’ve gotten most of it to work except creating a release.

My repository has three main steps:

  • Test python code
  • Build Binaries and test those binaries
  • If everything was successful and the PR is merged, create a tag and then create a DRAFT release.

In my workflow, I have raw-testing that will run on any push to main but the build-binaries job only triggers on a PR OR a tag push.

When I push a tag, the workflow doesn’t trigger at all. I think I didn’t do some of the logic correctly. What am I doing wrong?

Thanks!

:wave: Hey @sohmc,

It looks like your workflow is only filtering to specific branches. To include pushing a tag, you’ll want to add a tags: section to that push filter

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags

Example:

on:
  push:
    # Sequence of patterns matched against refs/heads
    branches:    
      # Push events on main branch
      - main
      # Push events to branches matching refs/heads/mona/octocat
      - 'mona/octocat'
      # Push events to branches matching refs/heads/releases/10
      - 'releases/**'
    # Sequence of patterns matched against refs/tags
    tags:        
      - v1             # Push events to v1 tag
      - v1.*           # Push events to v1.0, v1.1, and v1.9 tags