docker-ci.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: docker-ci
  2. on:
  3. push:
  4. branches:
  5. - 'master'
  6. release:
  7. types: [published]
  8. jobs:
  9. docker:
  10. runs-on: ubuntu-latest
  11. steps:
  12. -
  13. name: Checkout
  14. uses: actions/checkout@v2
  15. with:
  16. fetch-depth: 0
  17. -
  18. name: Find Git Tag
  19. id: tagger
  20. uses: jimschubert/query-tag-action@v2
  21. with:
  22. include: 'v*'
  23. exclude: '*-rc*'
  24. commit-ish: 'HEAD'
  25. skip-unshallow: 'true'
  26. abbrev: 7
  27. -
  28. name: Determine image tag type
  29. uses: haya14busa/action-cond@v1
  30. id: imgtag
  31. with:
  32. cond: ${{ github.event_name == 'release' }}
  33. if_true: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.event.release.tag_name }},${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
  34. if_false: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
  35. -
  36. name: Set up QEMU
  37. uses: docker/setup-qemu-action@v1
  38. -
  39. name: Set up Docker Buildx
  40. uses: docker/setup-buildx-action@v1
  41. -
  42. name: Login to DockerHub
  43. uses: docker/login-action@v1
  44. with:
  45. username: ${{ secrets.DOCKERHUB_USERNAME }}
  46. password: ${{ secrets.DOCKERHUB_TOKEN }}
  47. -
  48. name: Build and push
  49. id: docker_build
  50. uses: docker/build-push-action@v2
  51. with:
  52. context: .
  53. platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
  54. push: true
  55. tags: ${{ steps.imgtag.outputs.value }}
  56. build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}'