Skip to content

Commit

Permalink
fix: remove builder instances after build (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Mar 13, 2024
1 parent e9fb1c3 commit ac7ef05
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ on:
- 'docker-bake.hcl'
- '.github/workflows/CI.yml'
workflow_dispatch:
inputs:
tag:
description: 'which tag need to publish'
default: ''
required: false

jobs:
build:
strategy:
matrix:
target: [ "all", "18", "17", "16", "16-alpine", "15", "14", "13", "12", "11", "10", "9", "8", "7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -42,18 +40,14 @@ jobs:
- name: Check buildx bake
run: docker buildx bake --file docker-bake.hcl --print

- name: Build all images
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 ${{ matrix.target }}
if: github.ref == 'refs/heads/master'
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --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 an image for tag ${{ matrix.target }}
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --push

- name: Publish all images
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
- name: Remove builder instances
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: docker buildx rm --all-inactive --force

0 comments on commit ac7ef05

Please sign in to comment.