chore(ci): use matrix to separate slim and distrib build

This commit is contained in:
Nicolas Carlier 2024-01-20 10:27:15 +00:00
parent 8ea426222f
commit 8b4ef960d8

View File

@ -58,6 +58,14 @@ jobs:
publish: publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
strategy:
fail-fast: false
matrix:
include:
- target: slim
suffix: ''
- target: distrib
suffix: -distrib
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -69,7 +77,8 @@ jobs:
images: ncarlier/webhookd images: ncarlier/webhookd
tags: | tags: |
type=edge type=edge
type=semver,pattern={{version}} type=semver,pattern={{major}},suffix=${{ matrix.suffix }}
type=semver,pattern={{version}},suffix=${{ matrix.suffix }}
- uses: docker/setup-qemu-action@v1 - uses: docker/setup-qemu-action@v1
with: with:
image: tonistiigi/binfmt:latest image: tonistiigi/binfmt:latest
@ -80,21 +89,12 @@ jobs:
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image (slim) - name: Build and push Docker image (${{ matrix.target }})
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
target: slim target: ${{ matrix.target }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image (distrib)
uses: docker/build-push-action@v2
with:
context: .
target: distrib
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}-distrib
labels: ${{ steps.meta.outputs.labels }}