123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- name: docker-release
- on:
- push:
- branches:
- - stable
- - develop
- tags:
- - '*'
- jobs:
- docker-build-image:
- strategy:
- matrix:
- runs-on:
- - runner: ubuntu-22.04
- platform: 'amd64'
- - runner: ['self-hosted', 'arm64']
- platform: 'arm64'
- runs-on: ${{ matrix.runs-on.runner }}
- steps:
- - name: Checkout Code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Login to docker.io container registry
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Login to Quay.io
- uses: docker/login-action@v3
- 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@v5
- 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 }}
- - name: Build and push
- id: docker_build
- uses: docker/build-push-action@v6
- with:
- context: .
- labels: ${{ steps.meta.outputs.labels }}
- push: true
- tags: ${{ steps.meta.outputs.tags }}
- 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@v4
- with:
- fetch-depth: 0
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Login to docker.io container registry
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Login to Quay.io
- uses: docker/login-action@v3
- 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@v5
- with:
- images: ${{ matrix.target.image }}
- tags: |
- type=sha,suffix=-amd64
- - name: Get tag for arm64 image
- id: meta_arch_arm64
- uses: docker/metadata-action@v5
- with:
- images: ${{ matrix.target.image }}
- tags: |
- type=sha,suffix=-arm64
- - name: Get incrementing Zammad version from the most recent tag
- run: echo ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" >> $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@v5
- 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
- - name: Create manifest list and push
- run: |
- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | 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 }}
|