diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 3e87ba1..b41b1db 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -33,6 +33,8 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -41,15 +43,36 @@ jobs: - - name: Process tags - id: process-tags - run: echo "::set-output name=tags::$(echo ${{ steps.meta.outputs.tags }} | sed 's/v//')" + - name: Set Versions + uses: actions/github-script@v4 + id: set_version + with: + script: | + const tag = context.ref.substring(10) + const no_v = tag.replace('v', '') + const dash_index = no_v.lastIndexOf('-') + const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v + core.setOutput('tag', tag) + core.setOutput('no-v', no_v) + core.setOutput('no-dash', no_dash) - - name: Build and push Docker image - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + - name: Build and Push + uses: docker/build-push-action@v2 with: context: . push: true - tags: ${{ steps.process-tags.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: | + /${{secrets.DOCKERHUB_USERNAME}}/plopjs:latest + /${{secrets.DOCKERHUB_USERNAME}}/plopjs:${{steps.set_version.outputs.no-dash}} + + + + +# - name: Build and push Docker image +# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 +# with: +# context: . +# push: true +# tags: ${{ steps.process-tags.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }}