docker-publish.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: Set up QEMU
  18. uses: docker/setup-qemu-action@v2
  19. - name: Set up Docker Buildx
  20. id: buildx
  21. uses: docker/setup-buildx-action@v2
  22. - name: Log into registry ${{ env.REGISTRY }}
  23. uses: docker/login-action@v1
  24. with:
  25. registry: ${{ env.REGISTRY }}
  26. username: ${{ github.actor }}
  27. password: ${{ secrets.GITHUB_TOKEN }}
  28. - name: Extract Docker metadata
  29. id: meta
  30. uses: docker/metadata-action@v3
  31. with:
  32. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  33. tags: |
  34. type=ref,event=branch
  35. type=ref,event=pr
  36. type=semver,pattern={{version}}
  37. - name: Build and push Docker image
  38. uses: docker/build-push-action@v2
  39. with:
  40. context: .
  41. platforms: linux/amd64,linux/arm64
  42. push: true
  43. tags: ${{ steps.meta.outputs.tags }}
  44. labels: ${{ steps.meta.outputs.labels }}
  45. build-args: |
  46. VERSION=${{ steps.meta.outputs.version }}