Skip to content

Commit

Permalink
update bake-action to v6
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Jan 8, 2025
1 parent 906ecf0 commit 8eca792
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 58 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ jobs:
bake:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -392,12 +389,12 @@ jobs:
type=sha
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
files: |
./test/docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file-tags }}
${{ steps.docker_meta.outputs.bake-file-labels }}
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
targets: |
release
Expand Down Expand Up @@ -475,9 +472,6 @@ jobs:
bake-annotations:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -504,12 +498,12 @@ jobs:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
files: |
./test/docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file-tags }}
${{ steps.docker_meta.outputs.bake-file-annotations }}
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
cwd://${{ steps.docker_meta.outputs.bake-file-annotations }}
targets: |
release
Expand Down Expand Up @@ -539,7 +533,7 @@ jobs:
name: Print envs
run: env|sort

bake-cwd:
bake-path-context:
runs-on: ubuntu-latest
steps:
-
Expand All @@ -556,13 +550,13 @@ jobs:
uses: ./
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
source: "{{defaultContext}}"
source: .
files: |
./test/docker-bake.hcl
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
${{ steps.docker_meta.outputs.bake-file-tags }}
${{ steps.docker_meta.outputs.bake-file-labels }}
targets: |
release
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Test
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
targets: test
-
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.targets.outputs.matrix }}
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Targets matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v6
with:
target: validate

validate:
runs-on: ubuntu-latest
Expand All @@ -35,11 +36,8 @@ jobs:
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
targets: ${{ matrix.target }}
36 changes: 8 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
Expand All @@ -224,11 +221,11 @@ jobs:
type=sha
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
cwd://${{ steps.meta.outputs.bake-file }}
targets: build
```

Expand Down Expand Up @@ -271,29 +268,12 @@ similar to the previous one:
```yaml
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file-tags }}
${{ steps.meta.outputs.bake-file-labels }}
targets: build
```

If you're building a [remote Bake definition](https://docs.docker.com/build/bake/remote-definition/)
using a [Git context](https://github.com/docker/bake-action?tab=readme-ov-file#git-context),
you must specify the location of the metadata-only bake file using a `cwd://`
prefix:

```yaml
-
name: Build
uses: docker/bake-action@v5
with:
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
cwd://${{ steps.meta.outputs.bake-file-tags }}
cwd://${{ steps.meta.outputs.bake-file-labels }}
targets: build
```

Expand Down Expand Up @@ -1008,12 +988,12 @@ The same can be done with the [`bake-action`](https://github.com/docker/bake-act
images: name/app
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file-tags }}
${{ steps.meta.outputs.bake-file-annotations }}
cwd://${{ steps.meta.outputs.bake-file-tags }}
cwd://${{ steps.meta.outputs.bake-file-annotations }}
targets: build
```

Expand Down

0 comments on commit 8eca792

Please sign in to comment.