elgohr / Publish-Docker-Github-Action

A Github Action used to build and publish Docker images
MIT License
781 stars 209 forks source link

Question: Action does not get the tag-information #141

Closed abuhamsa closed 3 years ago

abuhamsa commented 3 years ago

Hi I'm trying to publish my dockerimage through this action. It already works and publishes my image to dockerhub.

But I want to have it released with the tags:

So my Action looks like this:

name: Publish to DockerHub
on:    
  release:
      types: [published]
jobs:
  update:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Publish to Registry
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name: abuhamsa/xteve-lazystream
        pre: echo ::save-state name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}
        tags: "latest,${{ env.STATE_RELEASE_VERSION }}"

I'll push my changes to github and then creating a new release: image

So I excpect that it will be published with the tags "latest" and "v.1.1.7". But the output of the action shows the following:

Warning: Unexpected input(s) 'pre', valid inputs are ['entryPoint', 'args', 'name', 'username', 'password', 'registry', 'snapshot', 'default_branch', 'dockerfile', 'workdir', 'context', 'buildargs', 'buildoptions', 'cache', 'tags', 'tag_names', 'tag_semver', 'no_push']
Run elgohr/Publish-Docker-Github-Action@master
  with:
    name: ***/xteve-lazystream
    pre: echo ::save-state name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
    username: ***
    password: ***
    tags: latest,

So there is an Warning about the "pre"-Part (which is used to even get the tag) and then the result is an empty string.

Am I doing this wrong or is it maybe broken for all?

elgohr commented 3 years ago

Maybe use https://github.com/elgohr/Publish-Docker-Github-Action#tag_names and another step for latest?

abuhamsa commented 3 years ago

Hi, wow that was way faster than expected.

I tried the following:

name: Publish to DockerHub with a verstion-tag and latest-tag
on:    
  release:
      types: [published]
jobs:
  update:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Publish to Registry with version-tag
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name: abuhamsa/xteve-lazystream
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}
        tag_names: true
    - name: Publish to Registry with latest-tag
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name: abuhamsa/xteve-lazystream
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}
        tags: "latest"

works now like a charm :) still I dont get why the other didn't work.

Thank you very much! Have a nice day