From 0c1c67d30b9f42ffa0b88611436918b208485343 Mon Sep 17 00:00:00 2001 From: Kalleby Santos <105971119+kallebysantos@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:24:25 +0000 Subject: [PATCH] feat: creating docker publish workflow --- .github/publish_docker.yml | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/publish_docker.yml diff --git a/.github/publish_docker.yml b/.github/publish_docker.yml new file mode 100644 index 0000000..f81aded --- /dev/null +++ b/.github/publish_docker.yml @@ -0,0 +1,67 @@ +name: Release on Dockerhub + +on: + push: + branches: + - main + paths: + - ".github/workflows/publish_docker.yml" + - "VERSION" + +jobs: + settings: + runs-on: ubuntu-latest + outputs: + docker_version: ${{ steps.settings.outputs.result }} + image_tag: supabase/supavisor:${{ steps.settings.outputs.result }} + steps: + - uses: actions/checkout@v3 + - id: settings + # Remove spaces to get the raw version string + run: echo "result=$(sed -r 's/\s+//g' VERSION)" >> $GITHUB_OUTPUT + + build_image: + needs: settings + strategy: + matrix: + include: + - runner: X64 + arch: amd64 + - runner: arm-runner + arch: arm64 + runs-on: ${{ matrix.runner }} + timeout-minutes: 180 + outputs: + image_digest: ${{ steps.build.outputs.digest }} + steps: + - run: docker context create builders + - uses: docker/setup-buildx-action@v3 + with: + endpoint: builders + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - id: build + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }} + platforms: linux/${{ matrix.arch }} + cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.arch }} + + merge_manifest: + needs: [settings, build_image] + runs-on: ubuntu-latest + steps: + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Merge multi-arch manifests + run: | + docker buildx imagetools create -t ${{ needs.settings.outputs.image_tag }} \ + ${{ needs.settings.outputs.image_tag }}_amd64 \ + ${{ needs.settings.outputs.image_tag }}_arm64