Skip to content

Commit 3f1692a

Browse files
committed
feat: add tag prefix input option and tag as an output
1 parent c9d1f2a commit 3f1692a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ with the build context. For example if you have `docker-build-context: ./tignis/
5757
**Note:**: This path is always from the root of the repository, not from the root of the build-context.
5858

5959
`platforms`: A comma separated list of platforms to build images for. Defaults to `linux/amd64,linux/arm64`.
60+
61+
`tag-prefix`: A prefix to add to the generated image tag. Defaults to an empty string.
62+
63+
## Outputs
64+
65+
`tag`: The image tag that was generated.

action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ inputs:
3333
description: 'Comma separated list of platforms to use for docker build'
3434
required: false
3535
default: 'linux/amd64,linux/arm64'
36+
tag-prefix:
37+
description: 'Prefix to add to generated docker tag'
38+
required: false
39+
default: ''
40+
outputs:
41+
tag: # id of output
42+
description: 'Tag used for the docker image'
43+
value: ${{ steps.meta.outputs.tags }}
3644
runs:
3745
using: "composite"
3846
steps:
@@ -54,8 +62,8 @@ runs:
5462
images: ${{ inputs.images }}
5563
# generate Docker tags based on the following events/attributes
5664
tags: |
57-
type=sha,prefix=${{env.BRANCH_NAME}}-${{env.DATE}}-${{github.run_number}}-,enable=${{ !startsWith(github.event_name, 'release') }}
58-
type=semver,pattern={{version}},enable=${{ startsWith(github.event_name, 'release') }}
65+
type=sha,prefix=${{inputs.tag-prefix}}${{env.BRANCH_NAME}}-${{env.DATE}}-${{github.run_number}}-,enable=${{ !startsWith(github.event_name, 'release') }}
66+
type=semver,pattern=${{inputs.tag-prefix}}{{version}},enable=${{ startsWith(github.event_name, 'release') }}
5967
- name: Set up Docker Context for Buildx
6068
id: buildx-context
6169
run: |

0 commit comments

Comments
 (0)