diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5205424..b18a6e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ name: Publish Docker Image + on: release: types: @@ -6,17 +7,77 @@ on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+-[abcehlprt]+.?[0-9]?[0-9]?' + jobs: - push_to_registry: - name: Publish Docker Image + build-amd64: + name: Build for linux/amd64 runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: tfgco/pusher - tag_with_ref: true + + - name: Build and push amd64 image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: tfgco/pusher:${{ github.ref_name }}-amd64 + provenance: false + + build-arm64: + name: Build for linux/arm64 + runs-on: ubuntu-22.04-arm + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push arm64 image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: tfgco/pusher:${{ github.ref_name }}-arm64 + provenance: false + + push-manifest: + name: Push multi-arch manifest + runs-on: ubuntu-latest + needs: [build-amd64, build-arm64] + steps: + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Inspect images before creating manifest (Debug Step) + run: | + echo "--- Inspecting AMD64 image ---" + docker buildx imagetools inspect tfgco/pusher:${{ github.ref_name }}-amd64 + echo "--- Inspecting ARM64 image ---" + docker buildx imagetools inspect tfgco/pusher:${{ github.ref_name }}-arm64 + + - name: Create and push manifest + run: | + docker manifest create tfgco/pusher:${{ github.ref_name }} \ + --amend tfgco/pusher:${{ github.ref_name }}-amd64 \ + --amend tfgco/pusher:${{ github.ref_name }}-arm64 + docker manifest push tfgco/pusher:${{ github.ref_name }} \ No newline at end of file