Skip to content

Commit 2c22bd5

Browse files
committed
feat: support build and publish specific image
1 parent 31c4994 commit 2c22bd5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ on:
1414
- 'docker-bake.hcl'
1515
- '**.yml'
1616
workflow_dispatch:
17+
inputs:
18+
tag:
19+
description: 'which tag need to publish'
20+
default: ''
21+
required: false
1722

1823
jobs:
1924
build:
@@ -38,9 +43,17 @@ jobs:
3843
run: docker buildx bake --file docker-bake.hcl --print
3944

4045
- name: Build all images
41-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
46+
if: github.ref == 'refs/heads/master' && github.event.inputs.tag == ''
4247
run: docker buildx bake --file docker-bake.hcl --load
4348

49+
- name: Publish an image for tag ${{ inputs.tag }}
50+
if: github.ref == 'refs/heads/master' && github.event.inputs.tag != ''
51+
run: docker buildx bake --file docker-bake.hcl ${{ inputs.tag }} --load
52+
4453
- name: Publish all images
45-
if: github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
54+
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && github.event.inputs.tag == ''
4655
run: docker buildx bake --file docker-bake.hcl --push
56+
57+
- name: Publish an image for tag ${{ inputs.tag }}
58+
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
59+
run: docker buildx bake --file docker-bake.hcl ${{ inputs.tag }} --push

0 commit comments

Comments
 (0)