build-public-images-ghcr.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Build Public Images GHCR
  2. on:
  3. push:
  4. tags: ['v*']
  5. concurrency:
  6. group: ${{ github.workflow }}-${{ github.ref }}
  7. cancel-in-progress: true
  8. jobs:
  9. build:
  10. runs-on: buildjet-16vcpu-ubuntu-2204
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Docker meta
  16. id: meta
  17. uses: docker/metadata-action@v5
  18. with:
  19. images: ghcr.io/plausible/community-edition
  20. tags: |
  21. type=semver,pattern={{version}},prefix=v
  22. type=semver,pattern={{major}}.{{minor}},prefix=v
  23. type=semver,pattern={{major}},prefix=v
  24. - name: Set up QEMU
  25. uses: docker/setup-qemu-action@v3
  26. - name: Set up Docker Buildx
  27. uses: docker/setup-buildx-action@v3
  28. - name: Login to GitHub Container Registry
  29. uses: docker/login-action@v3
  30. with:
  31. registry: ghcr.io
  32. username: ${{ github.actor }}
  33. password: ${{ secrets.GITHUB_TOKEN }}
  34. - name: Build and push
  35. id: docker_build
  36. uses: docker/build-push-action@v5
  37. with:
  38. push: true
  39. tags: ${{ steps.meta.outputs.tags }}
  40. labels: ${{ steps.meta.outputs.labels }}
  41. platforms: linux/amd64, linux/arm64
  42. cache-from: type=gha
  43. cache-to: type=gha,mode=max
  44. build-args: |
  45. MIX_ENV=ce
  46. BUILD_METADATA=${{ steps.meta.outputs.json }}
  47. ERL_FLAGS=+JPperf true
  48. - name: Image digest
  49. run: echo ${{ steps.docker_build.outputs.digest }}
  50. - name: Notify team on failure
  51. if: ${{ failure() }}
  52. uses: fjogeleit/http-request-action@v1
  53. with:
  54. url: ${{ secrets.BUILD_NOTIFICATION_URL }}
  55. method: 'POST'
  56. customHeaders: '{"Content-Type": "application/json"}'
  57. data: '{"content": "<a href=\"https://github.com/plausible/analytics/actions/workflows/build-public-images.yml\">Build failed</a>"}'