From 4a49a60feeceb2047b144ec51c04e814b483c790 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 18 Jan 2022 12:10:12 +0100 Subject: [PATCH] ci: publish packages to docker/buildx-pkg Signed-off-by: CrazyMax --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++++++++------ docker-bake.hcl | 2 +- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd0645c445c0..670925998501 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,8 @@ on: - 'v[0-9]*' env: - REPO_SLUG: "docker/buildx-bin" + BIN_REPO_SLUG: "docker/buildx-bin" + PKG_REPO_SLUG: "docker/buildx-pkg" RELEASE_OUT: "./release-out" jobs: @@ -71,7 +72,7 @@ jobs: uses: docker/metadata-action@v3 with: images: | - ${{ env.REPO_SLUG }} + ${{ env.BIN_REPO_SLUG }} tags: | type=ref,event=branch type=ref,event=pr @@ -112,6 +113,18 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ${{ env.PKG_REPO_SLUG }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + bake-target: meta-helper - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -121,10 +134,22 @@ jobs: with: driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} - - name: Build packages - run: | - make pkg-cross - tree ./bin + name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push image + uses: docker/bake-action@v1 + with: + files: | + ./docker-bake.hcl + ${{ steps.meta.outputs.bake-file }} + targets: pkg-cross + set: | + *.output=type=image,push=${{ github.event_name != 'pull_request' }} buildkit-edge: runs-on: ubuntu-latest diff --git a/docker-bake.hcl b/docker-bake.hcl index b5e78499503a..9e6682cc500e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -168,7 +168,7 @@ variable "PKG_PACKAGER" { } target "pkg" { - inherits = ["binaries"] + inherits = ["meta-helper", "binaries"] args = { PKG_TYPES = PKG_TYPES PKG_APK_RELEASES = PKG_APK_RELEASES