docker_build_pre.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: Docker Image CI Pre
  2. on:
  3. workflow_dispatch:
  4. release:
  5. types: [ prereleased ]
  6. env:
  7. REGISTRY: ghcr.io
  8. jobs:
  9. build-and-push-image:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Get version
  16. id: get_version
  17. run: |
  18. echo "VERSION=pre${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
  19. echo "${GITHUB_REF/refs\/tags\//}"
  20. echo "${GITHUB_REF#refs/*/}"
  21. echo "${GITHUB_REF}"
  22. echo "GITHASH=${git show -s --format=%H}" >> ${GITHASH}
  23. - uses: actions/checkout@v3
  24. - name: set lower case repository name
  25. run: |
  26. echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
  27. env:
  28. REPOSITORY: '${{ github.repository }}'
  29. - name: Set up QEMU
  30. uses: docker/setup-qemu-action@v3
  31. - name: Set up Docker Buildx
  32. uses: docker/setup-buildx-action@v3
  33. - uses: actions/setup-node@v4
  34. - name: Build FE
  35. run: make build_fe
  36. - name: Log in to the Container registry
  37. uses: docker/login-action@v2.1.0
  38. with:
  39. registry: ${{ env.REGISTRY }}
  40. username: ${{ github.actor }}
  41. password: ${{ secrets.GITHUB_TOKEN }}
  42. - name: Build and push Docker images
  43. uses: docker/build-push-action@v4
  44. with:
  45. build-args: |
  46. VERSION=${{ env.VERSION }}
  47. GITHASH=${{ env.GITHASH }}
  48. context: .
  49. file: ./DockerfileGithubAction
  50. platforms: |
  51. linux/386
  52. linux/amd64
  53. linux/arm/v7
  54. linux/arm64
  55. push: true
  56. tags: |
  57. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}