docker-ci.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. name: docker-ci
  2. on:
  3. push:
  4. tags:
  5. - 'v*.*.*'
  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. -
  17. name: Checkout
  18. uses: actions/checkout@v4
  19. with:
  20. fetch-depth: 0
  21. -
  22. name: Find Git Tag
  23. id: tagger
  24. uses: jimschubert/query-tag-action@v2
  25. with:
  26. include: 'v*'
  27. exclude: '*-rc*'
  28. commit-ish: 'HEAD'
  29. skip-unshallow: 'true'
  30. abbrev: 7
  31. - name: Docker meta
  32. id: meta
  33. uses: docker/metadata-action@v5
  34. with:
  35. # list of Docker images to use as base name for tags
  36. images: |
  37. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  38. # generate Docker tags based on the following events/attributes
  39. tags: |
  40. type=semver,pattern={{version}}
  41. type=semver,pattern={{major}}.{{minor}}
  42. type=semver,pattern={{major}}
  43. type=sha
  44. -
  45. name: Set up QEMU
  46. uses: docker/setup-qemu-action@v3
  47. -
  48. name: Set up Docker Buildx
  49. uses: docker/setup-buildx-action@v3
  50. -
  51. name: Login to DockerHub
  52. uses: docker/login-action@v3
  53. with:
  54. registry: ${{ env.REGISTRY }}
  55. username: ${{ github.actor }}
  56. password: ${{ secrets.GITHUB_TOKEN }}
  57. -
  58. name: Build and push
  59. id: docker_build
  60. uses: docker/build-push-action@v5
  61. with:
  62. context: .
  63. platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
  64. push: true
  65. tags: ${{ steps.meta.outputs.tags }}
  66. labels: ${{ steps.meta.outputs.labels }}
  67. build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}'