mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-20 19:38:18 +00:00
bd88a3678d
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5 to 6. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/v5...v6) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
130 lines
4.2 KiB
YAML
130 lines
4.2 KiB
YAML
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "docker/redis/Dockerfile"
|
|
- ".github/workflows/redis.yml"
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "docker/redis/Dockerfile"
|
|
- ".github/workflows/redis.yml"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- linux/amd64
|
|
- linux/arm/v7
|
|
- linux/arm64
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Docker meta
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ghcr.io/kumocorp/redis
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
|
|
type=ref,event=pr
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
- name: Log in to the Container registry
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: https://ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build No Push
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: docker/redis/Dockerfile
|
|
platforms: ${{ matrix.platform }}
|
|
push: false
|
|
- name: Build and push by digest
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
id: build
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: docker/redis/Dockerfile
|
|
platforms: ${{ matrix.platform }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
outputs: type=image,name=ghcr.io/kumocorp/redis,push-by-digest=true,name-canonical=true,push=true
|
|
- name: Export digest
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
id: digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
echo "DIGEST_NAME=$(echo ${{ matrix.platform }} | sed 's,/,-,g')" >> $GITHUB_OUTPUT
|
|
- name: Upload digest
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: digest-${{ steps.digest.outputs.DIGEST_NAME }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge:
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: digest-*
|
|
merge-multiple: true
|
|
path: /tmp/digests
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ghcr.io/kumocorp/redis
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
|
|
type=ref,event=tag,enable=${{ github.ref_type == 'tag' }}
|
|
type=ref,event=pr
|
|
- name: Login to GHCR
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: https://ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Create manifest list and push
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
docker buildx imagetools create \
|
|
${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
|
|
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf 'ghcr.io/kumocorp/redis@sha256:%s ' *)
|
|
- name: Inspect image
|
|
run: |
|
|
docker buildx imagetools inspect ghcr.io/kumocorp/redis:${{ steps.meta.outputs.version }}
|
|
|