docker-release.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. name: docker-release
  2. on:
  3. push:
  4. branches:
  5. - stable
  6. - develop
  7. tags:
  8. - '*'
  9. jobs:
  10. docker-build-image:
  11. strategy:
  12. matrix:
  13. runs-on:
  14. - runner: ubuntu-22.04
  15. platform: 'amd64'
  16. - runner: ['self-hosted', 'arm64']
  17. platform: 'arm64'
  18. runs-on: ${{ matrix.runs-on.runner }}
  19. steps:
  20. - name: Checkout Code
  21. uses: actions/checkout@v4
  22. with:
  23. fetch-depth: 0
  24. - name: Set up Docker Buildx
  25. uses: docker/setup-buildx-action@v3
  26. - name: Login to docker.io container registry
  27. uses: docker/login-action@v3
  28. with:
  29. username: ${{ secrets.DOCKER_USERNAME }}
  30. password: ${{ secrets.DOCKER_PASSWORD }}
  31. - name: Login to GitHub Container Registry
  32. uses: docker/login-action@v3
  33. with:
  34. registry: ghcr.io
  35. username: ${{ github.repository_owner }}
  36. password: ${{ secrets.GITHUB_TOKEN }}
  37. - name: Login to Quay.io
  38. uses: docker/login-action@v3
  39. with:
  40. registry: quay.io
  41. username: ${{ secrets.QUAY_USERNAME }}
  42. password: ${{ secrets.QUAY_ROBOT_TOKEN }}
  43. - name: Get tags for platform specific image
  44. id: meta
  45. uses: docker/metadata-action@v5
  46. with:
  47. images: |
  48. ghcr.io/${{ github.repository_owner }}/zammad
  49. index.docker.io/${{ github.repository_owner }}/zammad
  50. index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
  51. quay.io/${{ github.repository_owner }}/zammad
  52. tags: |
  53. type=sha,suffix=-${{ matrix.runs-on.platform }}
  54. - name: Build and push
  55. id: docker_build
  56. uses: docker/build-push-action@v5
  57. with:
  58. context: .
  59. labels: ${{ steps.meta.outputs.labels }}
  60. push: true
  61. tags: ${{ steps.meta.outputs.tags }}
  62. docker-create-multiarch-manifest:
  63. runs-on: ubuntu-22.04
  64. needs:
  65. - docker-build-image
  66. strategy:
  67. matrix:
  68. target:
  69. - image: ghcr.io/${{ github.repository_owner }}/zammad
  70. - image: index.docker.io/${{ github.repository_owner }}/zammad
  71. - image: quay.io/${{ github.repository_owner }}/zammad
  72. - image: index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
  73. steps:
  74. - name: Checkout Code
  75. uses: actions/checkout@v4
  76. with:
  77. fetch-depth: 0
  78. - name: Set up Docker Buildx
  79. uses: docker/setup-buildx-action@v3
  80. - name: Login to docker.io container registry
  81. uses: docker/login-action@v3
  82. with:
  83. username: ${{ secrets.DOCKER_USERNAME }}
  84. password: ${{ secrets.DOCKER_PASSWORD }}
  85. - name: Login to GitHub Container Registry
  86. uses: docker/login-action@v3
  87. with:
  88. registry: ghcr.io
  89. username: ${{ github.repository_owner }}
  90. password: ${{ secrets.GITHUB_TOKEN }}
  91. - name: Login to Quay.io
  92. uses: docker/login-action@v3
  93. with:
  94. registry: quay.io
  95. username: ${{ secrets.QUAY_USERNAME }}
  96. password: ${{ secrets.QUAY_ROBOT_TOKEN }}
  97. - name: Get tag for amd64 image
  98. id: meta_arch_amd64
  99. uses: docker/metadata-action@v5
  100. with:
  101. images: ${{ matrix.target.image }}
  102. tags: |
  103. type=sha,suffix=-amd64
  104. - name: Get tag for arm64 image
  105. id: meta_arch_arm64
  106. uses: docker/metadata-action@v5
  107. with:
  108. images: ${{ matrix.target.image }}
  109. tags: |
  110. type=sha,suffix=-arm64
  111. - name: Get incrementing Zammad version from the most recent tag
  112. run: echo ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" >> $GITHUB_ENV
  113. - name: Get Zammad major.minor version from the most recent tag
  114. run: echo ZAMMAD_VERSION_MAJOR_MINOR="$(git describe --tags | cut -f1-2 -d.)" >> $GITHUB_ENV
  115. - name: Get Zammad major version from the most recent tag
  116. run: echo ZAMMAD_VERSION_MAJOR="$(git describe --tags | cut -f1 -d.)" >> $GITHUB_ENV
  117. - name: Get tags for final multiarch reference
  118. id: meta
  119. uses: docker/metadata-action@v5
  120. with:
  121. images: ${{ matrix.target.image }}
  122. tags: |
  123. type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  124. type=raw,value=${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  125. type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR_MINOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  126. type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  127. type=ref,event=branch
  128. type=ref,event=tag
  129. type=sha
  130. - name: Create manifest list and push
  131. run: |
  132. 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 }}
  133. - name: Inspect image
  134. run: |
  135. docker buildx imagetools inspect ${{ matrix.target.image }}:${{ steps.meta.outputs.version }}