push-to-ghcr icon indicating copy to clipboard operation
push-to-ghcr copied to clipboard

Possibility to build images for pushed tags

Open exaexa opened this issue 1 year ago • 2 comments

Hi,

this action is very useful! Lately (given some github specialities about Releases and CI, which in turn prevent this from building tagged containers for Julia packages released by the official TagBot tooling) we decided that we'd like to build docker images for pushed tags instead of the published releases.

Would it be possible to have support for tags, basically in the same way as for releases?

I assume that for supporting tags, we'd only need to make the condition here (https://github.com/macbre/push-to-ghcr/blob/master/action.yml#L73) a little more generous towards the tag pushing, but I'm no github actions expert so maybe there's a hidden problem.

Thanks for any hints/comments here. If I get some free time I'll try a PR.

Best! -mk

exaexa avatar Jun 15 '24 10:06 exaexa

I assume that for supporting tags, we'd only need to make the condition here (https://github.com/macbre/push-to-ghcr/blob/master/action.yml#L73) a little more generous towards the tag pushing, but I'm no github actions expert so maybe there's a hidden problem.

Or you can just hook to the "tag pushed" event in your GitHub Action and pass the desired container tag via the image_tag action input. Something along:

on:
  # https://stackoverflow.com/a/63646054/5446110
  push:
    tags:
      - '*'

macbre avatar Jun 15 '24 11:06 macbre

ah ok, so I assume I would simply push in a "dynamic" image_tag, as in

 image_tag: ${{ github.ref }}

...plusminus a bit of iffage around to make sure weird refs don't reach this. Does that sound right?

exaexa avatar Jun 15 '24 18:06 exaexa

Does that sound right?

Correct :-) Closing then.

macbre avatar Nov 12 '24 11:11 macbre