Skip to content

Commit 77ef095

Browse files
committed
try to consolidate image tags
1 parent 3c9cc49 commit 77ef095

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

.github/workflows/docker-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
steps:
3535
- id: set-output-defaults
3636
run: |
37-
echo "::set-output name=tag::${{ env.IS_PRERELEASE == 'true' && 'alpha' || 'ubuntu' }}"
37+
echo "::set-output name=tag::${{ env.IS_PRERELEASE == 'true' && 'alpha' }}"
3838
echo "::set-output name=tag_latest::${{ env.IS_PRERELEASE == 'true' && 'false' || 'true' }}"
3939
4040
release-container:

.github/workflows/reusable-container-workflow.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
required: true
88
type: string
99
tag:
10-
required: true
10+
required: false
1111
type: string
1212
tag_latest:
1313
required: false
@@ -88,30 +88,26 @@ jobs:
8888
username: ${{ inputs.registry_username }}
8989
password: ${{ secrets.registry_password }}
9090

91-
- if: matrix.tag_main == 'true'
92-
name: Docker meta
91+
- name: Docker meta
9392
id: metadata
9493
uses: docker/metadata-action@v3
9594
with:
9695
images: |
9796
${{ inputs.image }}
9897
tags: |
99-
type=raw,value=latest,enable=${{ inputs.tag_latest }}
100-
type=raw,value=${{ inputs.tag }}
101-
type=raw,value=${{ inputs.tag }}-${{ matrix.tag }}
102-
type=raw,value=${{ inputs.release_version }},enable=${{ inputs.release_version != '' }}
103-
type=raw,value=${{ inputs.release_version }}-${{ matrix.tag }},enable=${{ inputs.release_version != '' }}
98+
# will set tag 'latest' for ubuntu build on production push
99+
type=raw,value=latest,enable=${{ matrix.tag_main && inputs.tag_latest }}
104100
105-
- if: matrix.tag_main == 'false'
106-
name: Docker meta
107-
id: metadata2
108-
uses: docker/metadata-action@v3
109-
with:
110-
images: |
111-
${{ inputs.image }}
112-
tags: |
101+
# will set tag like 'alpha' for ubuntu build, if inputs.tag is not empty
102+
type=raw,value=${{ inputs.tag }},enable=${{ matrix.tag_main }}
103+
104+
# will set tag like 'alpha-(ubuntu|alpine)', if inputs.tag is not empty
113105
type=raw,value=${{ inputs.tag }}-${{ matrix.tag }}
106+
107+
# will set tag like 'v0.12.0' for ubuntu build, if inputs.release_version is not empty
114108
type=raw,value=${{ inputs.release_version }},enable=${{ inputs.release_version != '' }}
109+
110+
# will set tag like 'v0.12.0-(ubuntu|alpine)', if inputs.release_version is not empty
115111
type=raw,value=${{ inputs.release_version }}-${{ matrix.tag }},enable=${{ inputs.release_version != '' }}
116112
117113
- name: Build release image

0 commit comments

Comments
 (0)