Allow container building on forks#570
Conversation
f7fdc39 to
60e1a20
Compare
60e1a20 to
7b89adb
Compare
| tags: ghcr.io/terrateamio/action:v1 | ||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} |
There was a problem hiding this comment.
@joshpollara @orbitz> this one to verify
There was a problem hiding this comment.
@tamiyasigmar per the code env.REGISTRY is ghcr.io and {{ github.repository }} is a system variable for the github repository so for tearrateam it will be terrateamio/action and for my fork it will be the-mentor/action and so on
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
There was a problem hiding this comment.
@the-mentor> what about github.ref_name? This is the part that looks like the actual change.
There was a problem hiding this comment.
@tamiyasigmar github.ref_name is the name of the branch.
so if you build the action on a branch called v1 the image tag will be v1 if you build it on a branch called v2 the tag will be v2 its a better approach then hard coding the branch name
|
@tamiyasigmar @orbitz Is there anything else this PR needs? |
|
I suppose removing dependency on docker action and refactor to composite would be the real fix. It's kind of sensible nowadays, see https://github.com/gruntwork-io/terragrunt-action |
I modified the workflows to use the ${{ github.repository }} variable to allow building and publishing on forks.
Also I replaced the hardcoded
v1with${{ github.ref_name }}which is the branch name.Since the trigger for the ci workflow is a push to the
v1branch in the future we can addv2and we wont have to modify the workflow to support the v2 tag.