From c4304ffb6f78f4d077f59125ab34db9c18c95614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Je=C5=BEek?= Date: Thu, 17 Oct 2024 10:20:26 +0200 Subject: [PATCH] ci(publish): build and publish image to dockerhub on release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Radek Ježek --- .github/workflows/publish-release-image.yml | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish-release-image.yml diff --git a/.github/workflows/publish-release-image.yml b/.github/workflows/publish-release-image.yml new file mode 100644 index 0000000..0a1c6c3 --- /dev/null +++ b/.github/workflows/publish-release-image.yml @@ -0,0 +1,37 @@ +name: build and publish release image + +on: + # On release events (also when a published release is converted from/to prerelease), push all patterns + release: + types: [released, prereleased] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Build and push bee-api image + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: | + iambeeagent/bee-api:latest + iambeeagent/bee-api:${{ steps.get_version.outputs.VERSION }} + cache-from: type=registry,ref=iambeeagent/bee-api:buildcache + cache-to: type=registry,ref=iambeeagent/bee-api:buildcache,mode=max