From 334c50d32e2dc04e6f1514fc0bd108d3d8c4151d Mon Sep 17 00:00:00 2001 From: "Paul S. Schweigert" Date: Fri, 18 Oct 2024 12:45:09 -0400 Subject: [PATCH] update release action to push to ghcr Signed-off-by: Paul S. Schweigert --- .../workflows/ghcr-publish-release-image.yml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/ghcr-publish-release-image.yml diff --git a/.github/workflows/ghcr-publish-release-image.yml b/.github/workflows/ghcr-publish-release-image.yml new file mode 100644 index 0000000..0efeef0 --- /dev/null +++ b/.github/workflows/ghcr-publish-release-image.yml @@ -0,0 +1,42 @@ +name: build and publish release image to GHCR + +on: + release: + types: [released, prereleased] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +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 GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_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: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max