release.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Release Docker image
  2. on:
  3. push:
  4. branches:
  5. - "main"
  6. env:
  7. REGISTRY: ghcr.io
  8. IMAGE_NAME: ${{ github.repository }}
  9. jobs:
  10. build-and-push-image:
  11. runs-on: ubuntu-latest
  12. permissions:
  13. contents: read
  14. packages: write
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v4
  18. - name: Log in to the Container registry
  19. uses: docker/login-action@v3
  20. with:
  21. registry: ${{ env.REGISTRY }}
  22. username: ${{ github.actor }}
  23. password: ${{ secrets.GITHUB_TOKEN }}
  24. - name: Extract metadata (tags, labels) for Docker
  25. id: meta
  26. uses: docker/metadata-action@v5
  27. with:
  28. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  29. tags: |
  30. type=schedule,pattern=nightly,enable=true,priority=1000
  31. type=ref,event=branch,enable=true,priority=600
  32. type=ref,event=tag,enable=true,priority=600
  33. type=ref,event=pr,prefix=pr-,enable=true,priority=600
  34. type=sha
  35. - name: Build and push Docker image
  36. uses: docker/build-push-action@v6
  37. with:
  38. context: .
  39. push: true
  40. tags: ${{ steps.meta.outputs.tags }}
  41. labels: ${{ steps.meta.outputs.labels }}