release.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. build-args: |
  33. GIT_COMMIT_SHA=${{ github.sha }}
  34. GIT_REPOSITORY_URL=https://github.com/${{ github.repository }}
  35. VERSION=${{ github.ref_name }}
  36. push: true
  37. tags: ${{ steps.meta.outputs.tags }}
  38. labels: ${{ steps.meta.outputs.labels }}