release.yml 2.3 KB

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