CI/CD 101, where am I going wrong?


Creating releases / atefacts / outputs / publishing from CI.

I may be going around this completely the wrong way, hence why I cannot seem to find a solution.

I have Nexus artefact repository set up to take Docker images.

In my pipeline, I build the container in a non-master branch. When I am happy with it, I want to create a PR, which once approved will push to master branch and publish the container image to Nexus.

I am having a hard time getting GitHub workflows to do the build and publish in different “phases”.

My ideas:

I’m aware of GitHub releases, but AFAIK, they don’t support container images. I would need to use a container repo such as or my own (Nexus).

Half the problem seems to be the on: statement. It happens at the start of the workflow. Is there a way to have multiple workflows with their own on: settings? This way the first one can build from non-master branches and the second one can build from master.

To achieve this, one way I am trying is to split my workflow into two jobs: build and publish. I’ve set if: github.event.pull_request.merged on the publish job but it never triggers. My on: statement looks like:

    branches: [ develop, master ]
    branches: [ master ]

Even echoing out github.event.pull_request.merged, never returns anything.

I’m sure this is CI/CD 101, but I can’t get it to work. Any help would be greatly appreciated.


Yes, you can have as many different workflows as you like and each one can have its own on: settings. What it looks like you’re trying to do is have it all in one file. If you split the two concepts into two separate files (each one containing a single workflow), then things should work better for you.

For example, in my select-matching-issues Action I have two separate workflows for testing and publishing.

Is that something that would help?

Thank you very much @lee-dohm.
Obvious when you know how.

This free training course also helped:

1 Like