Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Question) Possibility or using mutliple tags for a single build #7

Closed
V-ed opened this issue Jul 16, 2021 · 10 comments · Fixed by #19
Closed

(Question) Possibility or using mutliple tags for a single build #7

V-ed opened this issue Jul 16, 2021 · 10 comments · Fixed by #19

Comments

@V-ed
Copy link

V-ed commented Jul 16, 2021

Is it possible to run a build and tag it with multiple tags?

The use case would be to use extract-git-tag: true while also updating a latest tag up to date.

Thanks in advance!

@VaultVulp
Copy link
Owner

Hi, V-ed, and thanks for your contribution!

As far as I know - it's possible to do so. I'll add this feature in the near future.

I'm sure you already know this, but until this option is available, you can run this action multiple times in the same pipeline pushing two images subsequently.

@V-ed
Copy link
Author

V-ed commented Jul 20, 2021

Interesting! Thanks for the heads up :)

And while I thought about running it twice indeed, I was thinking about the fact that it would essentially build twice for no reason, as it is the same image - I was already trying to optimize my pipelines haha

I also though about potentially using the custom-args option, but didn't try yet, with a (small) fear that it it would break the extract-git-tag option (by overriding the option of the docker command). If I ever get around to trying to use custom-args to add another image tag, I'll update the issue here.

@justinmchase
Copy link

This was the first thing I looked for, I generally want to generate 3 tags based on the version. I'd like to have this:

    - name: Build and Publish head Docker image
      uses: VaultVulp/gp-docker-action@1.2.0
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        image-name: my-cool-service
        image-tags:
          - latest
          - "${{ steps.increment.outputs.version }}"
          - "${{ steps.increment.outputs.major }}.${{ steps.increment.outputs.minor }}"

@manang
Copy link

manang commented Oct 26, 2022

question: did you push this modification?
Thanks

@VaultVulp
Copy link
Owner

@manang Not yet, sadly.

@VaultVulp
Copy link
Owner

VaultVulp commented Oct 30, 2022

As far as I know, it's impossible to pass list values to the github actions.
So, the following syntax is invalid:

      image-tags:
          - latest
          - "${{ steps.increment.outputs.version }}"
          - "${{ steps.increment.outputs.major }}.${{ steps.increment.outputs.minor }}"

but, I guess I could try to implement something similar to:

    additional-image-tags: "foo bar buz" 

@VaultVulp
Copy link
Owner

VaultVulp commented Oct 30, 2022

Done!

Example workflow:

name: Build and publish 

on: push

jobs:
  build-with-multiple-tags:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2.5.0 # Checking out the repo
 
    - name: Build with multiple tags
      uses: VaultVulp/gp-docker-action@1.4.0
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
        image-name: my-cool-service # Provide Docker image name
        image-tags: first # if ommitted will be replaced with "latest"
        additional-image-tags: second third # two additional tags for an image

@justinmchase
Copy link

Not to be too picky, but why not an array?

image-tags:
- first
- second
- third

It would come through as a string or array, so it should be a non-breaking change.

@VaultVulp
Copy link
Owner

@justinmchase
As far as I understood, Github Actions do not support list values for inputs.
When I tried to use both list notaions that YAML supports (yours and image-tags: [first, second, third]) i got the same error: "Invalid type found: one of string , number , boolean were expected but an array was found".
So I had to use space-separated string instead.

If you can point me to the documentation or an example that shows how to pass list of values into the input - I'll try to reimplement my action.

@justinmchase
Copy link

Ok, wow, I never noticed that before but it seems like the places where I have been configuring "arrays" have been like this:

languages: javascript, typescript

While I thought it was:

languages: [javascript, typescript]

Which is indeed, not an array, technically. So my mistake, thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants