docker-release.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: Get version tag in the old way
  28. run: echo ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" >> $GITHUB_ENV
  29. - name: Docker metadata action
  30. id: meta
  31. uses: docker/metadata-action@v4
  32. with:
  33. images: |
  34. index.docker.io/zammad/zammad-docker-compose
  35. tags: |
  36. type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  37. type=raw,value=${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  38. type=raw,value=zammad-${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
  39. type=ref,event=branch
  40. type=ref,event=tag
  41. type=semver,pattern={{major}}
  42. type=semver,pattern={{major}}.{{minor}}
  43. type=semver,pattern={{version}}
  44. type=sha
  45. - name: Build and push
  46. id: docker_build
  47. uses: docker/build-push-action@v3
  48. with:
  49. context: .
  50. labels: ${{ steps.meta.outputs.labels }}
  51. # arm64 build takes up to 4 hours
  52. platforms: linux/amd64 #,linux/arm64
  53. push: true
  54. tags: ${{ steps.meta.outputs.tags }}
  55. - name: Image digest
  56. run: echo ${{ steps.docker_build.outputs.digest }}