diff --git a/.github/workflows/build-image-debian.yaml b/.github/workflows/build-image-debian.yaml index fb6e2be..528bda7 100644 --- a/.github/workflows/build-image-debian.yaml +++ b/.github/workflows/build-image-debian.yaml @@ -10,8 +10,11 @@ on: branches: - master +env: + REGISTRY_IMAGE: invoiceninja/invoiceninja-debian + jobs: - docker: + build: runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} strategy: fail-fast: false @@ -21,6 +24,24 @@ jobs: - name: Checkout uses: actions/checkout@v5 + - name: Prepare + id: prep + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 @@ -31,6 +52,48 @@ jobs: with: context: debian load: true - tags: invoiceninja/invoiceninja-debian:test + tags: ${{ env.REGISTRY_IMAGE }}:test cache-from: type=gha cache-to: type=gha,mode=max + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-* + merge-multiple: true + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Create manifest list (--dry-run) + working-directory: ${{ runner.temp }}/digests + run: | + docker buildx imagetools create --dry-run $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}