You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

  1. name: build
  2. on:
  3. push:
  4. push:
  5. branches:
  6. - master
  7. tags:
  8. - v*
  9. - latest
  10. jobs:
  11. build:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v2.3.4
  15. with:
  16. submodules: true
  17. - uses: docker/setup-qemu-action@v1.1.0
  18. - uses: docker/setup-buildx-action@v1.3.0
  19. - uses: docker/login-action@v1.9.0
  20. with:
  21. password: ${{ secrets.DOCKER_PASSWORD }}
  22. username: ${{ secrets.DOCKER_USERNAME }}
  23. - name: check and set image version
  24. id: prepare
  25. run: |
  26. case ${{ github.ref }} in
  27. refs/heads/master)
  28. echo ::set-output name=version::edge
  29. echo ::set-output name=push::true
  30. ;;
  31. refs/tags/*)
  32. echo ::set-output name=version::$(echo ${{ github.ref }} | sed -E 's|refs/tags/||')
  33. echo ::set-output name=push::true
  34. ;;
  35. *)
  36. echo ::set-output name=version::${{ github.sha }}
  37. echo ::set-output name=push::false
  38. ;;
  39. esac;
  40. - name: build & push image
  41. uses: docker/build-push-action@v4.0.0
  42. with:
  43. context: .
  44. file: docker/alpine/Dockerfile
  45. platforms: linux/amd64,linux/arm64
  46. push: ${{ steps.prepare.outputs.push }}
  47. tags: ${{ github.repository }}:${{ steps.prepare.outputs.version }}