You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

  1. name: Build container image
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - 'main'
  7. pull_request:
  8. paths:
  9. - .github/workflows/build-image.yml
  10. - Dockerfile
  11. permissions:
  12. contents: read
  13. packages: write
  14. jobs:
  15. build-image:
  16. runs-on: ubuntu-latest
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.ref }}
  19. cancel-in-progress: true
  20. steps:
  21. - uses: actions/checkout@v3
  22. - uses: hadolint/hadolint-action@v3.1.0
  23. - uses: docker/setup-qemu-action@v2
  24. - uses: docker/setup-buildx-action@v2
  25. - uses: docker/login-action@v2
  26. with:
  27. registry: ghcr.io
  28. username: ${{ github.repository_owner }}
  29. password: ${{ secrets.GITHUB_TOKEN }}
  30. if: github.event_name != 'pull_request'
  31. - uses: docker/metadata-action@v4
  32. id: meta
  33. with:
  34. images: ghcr.io/${{ github.repository_owner }}/mastodon
  35. tags: |
  36. type=raw,value=latest,enable={{is_default_branch}}
  37. type=edge,branch=main
  38. type=sha,prefix=,format=long
  39. - uses: docker/build-push-action@v4
  40. with:
  41. context: .
  42. platforms: linux/amd64,linux/arm64
  43. provenance: false
  44. builder: ${{ steps.buildx.outputs.name }}
  45. push: ${{ github.event_name != 'pull_request' }}
  46. tags: ${{ steps.meta.outputs.tags }}
  47. cache-from: type=gha
  48. cache-to: type=gha,mode=max