docker-publish.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: Docker Image
  2. on:
  3. release:
  4. types: [created]
  5. env:
  6. REGISTRY: ghcr.io
  7. IMAGE_NAME: ${{ github.repository }}
  8. jobs:
  9. build:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Checkout repository
  16. uses: actions/checkout@v2
  17. - name: Log into registry ${{ env.REGISTRY }}
  18. uses: docker/login-action@v1
  19. with:
  20. registry: ${{ env.REGISTRY }}
  21. username: ${{ github.actor }}
  22. password: ${{ secrets.GITHUB_TOKEN }}
  23. - name: Extract Docker metadata
  24. id: meta
  25. uses: docker/metadata-action@v3
  26. with:
  27. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  28. tags: |
  29. type=ref,event=branch
  30. type=ref,event=pr
  31. type=semver,pattern={{version}}
  32. - name: Build and push Docker image
  33. uses: docker/build-push-action@v2
  34. with:
  35. context: .
  36. push: true
  37. tags: ${{ steps.meta.outputs.tags }}
  38. labels: ${{ steps.meta.outputs.labels }}
  39. build-args: |
  40. VERSION=${{ steps.meta.outputs.version }}