release.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Build and Release Electron App and Docker Image
  2. on:
  3. push:
  4. tags:
  5. - "*" # Triggers on any tag
  6. jobs:
  7. build_and_release:
  8. runs-on: ${{ matrix.os }}
  9. strategy:
  10. matrix:
  11. include:
  12. - os: macos-latest
  13. name: "macOS Build"
  14. - os: ubuntu-latest
  15. name: "Ubuntu Build"
  16. - os: windows-latest
  17. name: "Windows Build"
  18. - os: ubuntu-latest
  19. name: "Docker Build"
  20. platform: linux/amd64,linux/arm64,linux/arm/v7
  21. steps:
  22. - name: Check out Git repository
  23. uses: actions/checkout@v4
  24. - name: Install Node.js, NPM, and Yarn
  25. uses: actions/setup-node@v4
  26. with:
  27. node-version: 22
  28. - name: Build client (only for non-Docker jobs)
  29. if: matrix.name != 'Docker Build'
  30. run: |
  31. cd client
  32. yarn --network-timeout 100000
  33. yarn build
  34. cp -r build ../server
  35. - name: Build and Release Electron App
  36. if: matrix.name != 'Docker Build'
  37. uses: samuelmeuli/action-electron-builder@v1
  38. with:
  39. package_root: "./server"
  40. build_script_name: "build-electron"
  41. github_token: ${{ secrets.GH_TOKEN }}
  42. release: ${{ startsWith(github.ref, 'refs/tags/') }}
  43. - name: Set up Docker Buildx (only for Docker job)
  44. if: matrix.name == 'Docker Build'
  45. uses: docker/setup-buildx-action@v3
  46. - name: Login to DockerHub (only for Docker job)
  47. if: matrix.name == 'Docker Build'
  48. uses: docker/login-action@v1
  49. with:
  50. username: ${{ secrets.DOCKER_USERNAME }}
  51. password: ${{ secrets.DOCKER_PWD }}
  52. - name: Build and Push Docker Image
  53. if: matrix.name == 'Docker Build'
  54. uses: docker/build-push-action@v5
  55. with:
  56. context: .
  57. platforms: ${{ matrix.platform }}
  58. tags: |
  59. zilliz/attu:${{ github.ref_name }}
  60. cache-from: type=registry,ref=zilliz/attu:cache
  61. cache-to: type=inline
  62. build-args: |
  63. VERSION=${{ github.ref_name }}
  64. push: true
  65. release_draft:
  66. needs: build_and_release
  67. runs-on: ubuntu-latest
  68. if: ${{ startsWith(github.ref, 'refs/tags/') }}
  69. steps:
  70. - name: Create GitHub Release Draft
  71. uses: actions/create-release@v1
  72. with:
  73. tag_name: ${{ github.ref_name }}
  74. release_name: "Release ${{ github.ref_name }}"
  75. draft: true
  76. prerelease: false
  77. token: ${{ secrets.GH_TOKEN }}