release.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: Release 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@v3
  17. - name: Log in to the Container registry
  18. uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
  19. with:
  20. registry: ${{ env.REGISTRY }}
  21. username: ${{ github.actor }}
  22. password: ${{ secrets.GITHUB_TOKEN }}
  23. - name: Extract metadata (tags, labels) for Docker
  24. id: meta
  25. uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
  26. with:
  27. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  28. - name: Build and push Docker image
  29. uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
  30. with:
  31. context: .
  32. push: true
  33. tags: ${{ steps.meta.outputs.tags }}
  34. labels: ${{ steps.meta.outputs.labels }}