build-image.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Build container image
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - 'main'
  7. tags:
  8. - '*'
  9. pull_request:
  10. paths:
  11. - .github/workflows/build-image.yml
  12. - Dockerfile
  13. permissions:
  14. contents: read
  15. jobs:
  16. build-image:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v3
  20. - uses: docker/setup-qemu-action@v2
  21. - uses: docker/setup-buildx-action@v2
  22. - uses: docker/login-action@v2
  23. with:
  24. username: ${{ secrets.DOCKERHUB_USERNAME }}
  25. password: ${{ secrets.DOCKERHUB_TOKEN }}
  26. if: github.event_name != 'pull_request'
  27. - uses: docker/metadata-action@v4
  28. id: meta
  29. with:
  30. images: tootsuite/mastodon
  31. flavor: |
  32. latest=auto
  33. tags: |
  34. type=edge,branch=main
  35. type=pep440,pattern={{raw}}
  36. type=pep440,pattern=v{{major}}.{{minor}}
  37. type=ref,event=pr
  38. - uses: docker/build-push-action@v3
  39. with:
  40. context: .
  41. platforms: linux/amd64,linux/arm64
  42. push: ${{ github.event_name != 'pull_request' }}
  43. tags: ${{ steps.meta.outputs.tags }}
  44. cache-from: type=registry,ref=tootsuite/mastodon:edge
  45. cache-to: type=inline