mailhog-docker/.github/workflows/matrix-build.yml

78 lines
2 KiB
YAML
Raw Normal View History

2023-12-01 16:39:20 +00:00
name: docker
on:
push:
tags:
- "v*"
env:
2023-12-01 16:47:15 +00:00
DOCKER_REPO: richarvey/mailhog
2023-12-01 16:39:20 +00:00
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
2023-12-01 17:16:25 +00:00
- linux/arm/v6
- linux/arm/v7
2023-12-01 16:39:20 +00:00
steps:
- name: Set vars
id: vars
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "platform=$(echo -n ${{ matrix.platform }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
2024-03-29 22:32:39 +00:00
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
2023-12-01 16:39:20 +00:00
- name: Login to Docker Hub
2024-03-29 22:32:39 +00:00
uses: docker/login-action@v3
2023-12-01 16:39:20 +00:00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build docker images
2024-03-29 22:32:39 +00:00
uses: docker/build-push-action@v5
2023-12-01 16:39:20 +00:00
with:
context: .
push: true
platforms: ${{ matrix.platform }}
tags: |
${{ env.DOCKER_REPO }}:${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.platform }}
release:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build
steps:
- name: Set vars
id: vars
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
2024-03-29 22:32:39 +00:00
uses: docker/login-action@v3
2023-12-01 16:39:20 +00:00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create Docker Hub manifest
run: |
2023-12-01 17:01:47 +00:00
docker manifest create $DOCKER_REPO:latest \
2023-12-01 16:39:20 +00:00
$DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \
2023-12-01 17:16:25 +00:00
$DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm64 \
$DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm-v6 \
$DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm-v7
2023-12-01 16:39:20 +00:00
- name: Push manifests
run: |
2023-12-01 16:54:38 +00:00
docker manifest push $DOCKER_REPO:latest