mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
Before, tags hat variable lengths (7.0.0, 7.0.0-9, 7.0.0-12) which prevented alphabetical sorting of the versions (required by tools like updatecli). This is changed by introducing a fixed format with 4 digits for the commit sequence number (7.0.0-0000, 7.0.0-0012, …).
181 lines
No EOL
6.4 KiB
YAML
181 lines
No EOL
6.4 KiB
YAML
name: docker-release
|
|
|
|
# See
|
|
# https://github.com/docker/docs/issues/18835
|
|
# https://docs.docker.com/reference/cli/docker/buildx/imagetools/create/
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- stable
|
|
tags:
|
|
- '*'
|
|
schedule:
|
|
# Build for develop only once per workday to avoid hitting rate limits on docker hub.
|
|
- cron: '10 6 * * 1-5'
|
|
|
|
jobs:
|
|
docker-build-image:
|
|
strategy:
|
|
matrix:
|
|
runs-on:
|
|
- runner: ubuntu-24.04
|
|
platform: 'amd64'
|
|
- runner: ['self-hosted', 'arm64']
|
|
platform: 'arm64'
|
|
runs-on: ${{ matrix.runs-on.runner }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to docker.io container registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Quay.io
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.QUAY_USERNAME }}
|
|
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
|
|
|
|
- name: Get tags for platform specific image
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ github.repository_owner }}/zammad
|
|
index.docker.io/${{ github.repository_owner }}/zammad
|
|
index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
|
|
quay.io/${{ github.repository_owner }}/zammad
|
|
tags: |
|
|
type=sha,suffix=-${{ matrix.runs-on.platform }}
|
|
env:
|
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,manifest-descriptor
|
|
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
build-args: |
|
|
COMMIT_SHA=${{ github.sha }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
pull: true
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
annotations: ${{ steps.meta.outputs.annotations }}
|
|
|
|
docker-create-multiarch-manifest:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- docker-build-image
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- image: ghcr.io/${{ github.repository_owner }}/zammad
|
|
- image: index.docker.io/${{ github.repository_owner }}/zammad
|
|
- image: quay.io/${{ github.repository_owner }}/zammad
|
|
- image: index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to docker.io container registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Quay.io
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.QUAY_USERNAME }}
|
|
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
|
|
|
|
- name: Get tag for amd64 image
|
|
id: meta_arch_amd64
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ matrix.target.image }}
|
|
tags: |
|
|
type=sha,suffix=-amd64
|
|
|
|
- name: Get tag for arm64 image
|
|
id: meta_arch_arm64
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ matrix.target.image }}
|
|
tags: |
|
|
type=sha,suffix=-arm64
|
|
|
|
- name: Get incrementing Zammad version from the most recent tag
|
|
# Make sure the number is always present (via --long), and pad it to four digits
|
|
# for proper alphabetical sorting in tools like updatecli (e.g. 7.0.0-0000, 7.1.0-0215).
|
|
run: echo ZAMMAD_VERSION="$(git describe --tags --long | awk -F'-' '{printf "%s-%04d\n", $1, $(NF-1)}')" >> $GITHUB_ENV
|
|
|
|
- name: Get Zammad major.minor version from the most recent tag
|
|
run: echo ZAMMAD_VERSION_MAJOR_MINOR="$(git describe --tags | cut -f1-2 -d.)" >> $GITHUB_ENV
|
|
|
|
- name: Get Zammad major version from the most recent tag
|
|
run: echo ZAMMAD_VERSION_MAJOR="$(git describe --tags | cut -f1 -d.)" >> $GITHUB_ENV
|
|
|
|
- name: Get tags for final multiarch reference
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ matrix.target.image }}
|
|
# Don't automatically generate a 'latest' tag for the default branch.
|
|
# https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input
|
|
flavor: |
|
|
latest=false
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
|
|
type=raw,value=${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
|
|
type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR_MINOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
|
|
type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=sha
|
|
env:
|
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
|
|
|
|
- name: Create manifest list and push
|
|
# Build and run a complex command line with eval to avoid wrong word splitting on spaces in the annotations.
|
|
run: |
|
|
eval "docker buildx imagetools create \
|
|
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(jq -cr '.annotations | map("--annotation \"" + . + "\"") | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
${{ steps.meta_arch_amd64.outputs.tags }} \
|
|
${{ steps.meta_arch_arm64.outputs.tags }}"
|
|
|
|
- name: Inspect image
|
|
run: |
|
|
docker buildx imagetools inspect ${{ matrix.target.image }}:${{ steps.meta.outputs.version }} |