container-image.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. name: container image
  3. on:
  4. push:
  5. pull_request:
  6. schedule:
  7. - cron: '0 20 * * 5'
  8. jobs:
  9. docker-build:
  10. runs-on: ubuntu-24.04
  11. permissions: {packages: write}
  12. steps:
  13. - id: meta
  14. # > "automatic" tag management and OCI Image Format Spec… for labels
  15. # https://web.archive.org/web/20250103123053/https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
  16. uses: docker/metadata-action@v5
  17. with:
  18. # see comment on `push: true` below
  19. images: ghcr.io/${{ github.repository_owner }}/onion-service
  20. # https://web.archive.org/web/20250103130404/https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input
  21. tags: |
  22. type=ref,event=branch
  23. type=ref,event=pr
  24. type=sha,format=long
  25. type=raw,value=latest,enable=false
  26. - uses: docker/setup-qemu-action@v3.6.0
  27. - uses: docker/login-action@v3
  28. with:
  29. registry: ghcr.io
  30. username: ${{ github.actor }}
  31. password: ${{ secrets.GITHUB_TOKEN }}
  32. - uses: docker/setup-buildx-action@v3.11.1
  33. # > By default, this action uses the Git context so you don't need to use
  34. # > the actions/checkout action to checkout the repository because this
  35. # > will be done directly by buildkit. [...]
  36. # > any file mutation in the steps that precede [...] will be ignored,
  37. # > including processing of the .dockerignore file
  38. # https://github.com/marketplace/actions/build-and-push-docker-images
  39. # > The commit history is not preserved.
  40. # https://docs.docker.com/engine/reference/commandline/build/#git-repositories
  41. - uses: docker/build-push-action@v6.18.0
  42. with:
  43. platforms: |
  44. linux/amd64
  45. linux/arm/v6
  46. linux/arm/v7
  47. linux/arm64
  48. # potential alternative: https://github.com/docker/metadata-action
  49. build-args: REVISION=${{ github.sha }}
  50. # > Require approval for all external contributors
  51. # > All users that are not a member or owner of this repository will
  52. # > require approval to run workflows.
  53. # https://github.com/fphammerle/systemctl-mqtt/settings/actions
  54. push: true
  55. tags: ${{ steps.meta.outputs.tags }}
  56. labels: ${{ steps.meta.outputs.labels }}