Skip to content

Commit

Permalink
feat: support build and publish specific image
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Sep 30, 2023
1 parent 31c4994 commit 2c22bd5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
- 'docker-bake.hcl'
- '**.yml'
workflow_dispatch:
inputs:
tag:
description: 'which tag need to publish'
default: ''
required: false

jobs:
build:
Expand All @@ -38,9 +43,17 @@ jobs:
run: docker buildx bake --file docker-bake.hcl --print

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

- name: Publish an image for tag ${{ inputs.tag }}
if: github.ref == 'refs/heads/master' && github.event.inputs.tag != ''
run: docker buildx bake --file docker-bake.hcl ${{ inputs.tag }} --load

- name: Publish all images
if: github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && github.event.inputs.tag == ''
run: docker buildx bake --file docker-bake.hcl --push

- name: Publish an image for tag ${{ inputs.tag }}
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
run: docker buildx bake --file docker-bake.hcl ${{ inputs.tag }} --push

0 comments on commit 2c22bd5

Please sign in to comment.