build-image.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. jobs:
  14. build-image:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v2
  18. - uses: docker/setup-qemu-action@v1
  19. - uses: docker/setup-buildx-action@v1
  20. - uses: docker/login-action@v1
  21. with:
  22. username: ${{ secrets.DOCKERHUB_USERNAME }}
  23. password: ${{ secrets.DOCKERHUB_TOKEN }}
  24. if: github.event_name != 'pull_request'
  25. - uses: docker/metadata-action@v3
  26. id: meta
  27. with:
  28. images: tootsuite/mastodon
  29. flavor: |
  30. latest=auto
  31. tags: |
  32. type=edge,branch=main
  33. type=match,pattern=v(.*),group=0
  34. type=ref,event=pr
  35. - uses: docker/build-push-action@v2
  36. with:
  37. context: .
  38. platforms: linux/amd64,linux/arm64
  39. push: ${{ github.event_name != 'pull_request' }}
  40. tags: ${{ steps.meta.outputs.tags }}
  41. cache-from: type=registry,ref=tootsuite/mastodon:latest
  42. cache-to: type=inline