release.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: Create and publish a Docker image
  2. on:
  3. release:
  4. types: [published]
  5. env:
  6. REGISTRY: ghcr.io
  7. IMAGE_NAME: ${{ github.repository }}
  8. jobs:
  9. build-and-push-image:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Checkout repository
  16. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  17. - name: Set up QEMU
  18. uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
  19. - name: Set up Docker Buildx
  20. id: buildx
  21. uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
  22. - name: Log in to Docker Hub
  23. uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
  24. with:
  25. username: ${{ github.actor }}
  26. password: ${{ secrets.DOCKER_PASSWORD }}
  27. - name: Log in to the Container registry
  28. uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
  29. with:
  30. registry: ${{ env.REGISTRY }}
  31. username: ${{ github.actor }}
  32. password: ${{ secrets.GITHUB_TOKEN }}
  33. - name: Extract metadata (tags, labels) for Docker
  34. id: meta
  35. uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
  36. with:
  37. images: |
  38. zricethezav/gitleaks
  39. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  40. - name: Build and push Docker image
  41. uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
  42. with:
  43. platforms: linux/amd64,linux/arm64
  44. context: .
  45. push: true
  46. tags: ${{ steps.meta.outputs.tags }}
  47. labels: ${{ steps.meta.outputs.labels }}