docker-release.yaml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: docker-release
  2. on:
  3. push:
  4. branches:
  5. - stable
  6. - develop
  7. tags:
  8. - '*'
  9. jobs:
  10. docker-build-push:
  11. runs-on: ubuntu-22.04
  12. steps:
  13. - name: Checkout Code
  14. uses: actions/checkout@v3
  15. with:
  16. fetch-depth: 0
  17. # # only needed for arm64 builds
  18. # - name: Set up QEMU
  19. # uses: docker/setup-qemu-action@v2
  20. - name: Set up Docker Buildx
  21. uses: docker/setup-buildx-action@v2
  22. - name: Login to docker.io container registry
  23. uses: docker/login-action@v2
  24. with:
  25. username: ${{ secrets.DOCKER_USERNAME }}
  26. password: ${{ secrets.DOCKER_PASSWORD }}
  27. - name: Login to GitHub Container Registry
  28. uses: docker/login-action@v2
  29. with:
  30. registry: ghcr.io
  31. username: ${{ github.repository_owner }}
  32. password: ${{ secrets.GITHUB_TOKEN }}
  33. - name: Login to Quay.io
  34. uses: docker/login-action@v2
  35. with:
  36. registry: quay.io
  37. username: ${{ secrets.QUAY_USERNAME }}
  38. password: ${{ secrets.QUAY_ROBOT_TOKEN }}
  39. - name: Get version tag in the old way
  40. run: echo ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" >> $GITHUB_ENV
  41. - name: Docker metadata action
  42. id: meta
  43. uses: docker/metadata-action@v4
  44. with:
  45. images: |
  46. ghcr.io/${{ github.repository_owner }}/zammad
  47. index.docker.io/${{ github.repository_owner }}/zammad
  48. index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
  49. quay.io/${{ github.repository_owner }}/zammad
  50. tags: |
  51. type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  52. type=raw,value=${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  53. type=raw,value=zammad-${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  54. type=ref,event=branch
  55. type=ref,event=tag
  56. type=semver,pattern={{major}}
  57. type=semver,pattern={{major}}.{{minor}}
  58. type=semver,pattern={{version}}
  59. type=sha
  60. - name: Build and push
  61. id: docker_build
  62. uses: docker/build-push-action@v4
  63. with:
  64. context: .
  65. labels: ${{ steps.meta.outputs.labels }}
  66. # arm64 build takes up to 4 hours
  67. platforms: linux/amd64 #,linux/arm64
  68. push: true
  69. tags: ${{ steps.meta.outputs.tags }}
  70. - name: Image digest
  71. run: echo ${{ steps.docker_build.outputs.digest }}