release.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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: Extract Major.Minor tag (only for Docker job)
  25. if: matrix.name == 'Docker Build'
  26. uses: damienaicheh/extract-version-from-tag-action@v1.3.0
  27. - name: Install Node.js, NPM, and Yarn
  28. uses: actions/setup-node@v4
  29. with:
  30. node-version: 22
  31. - name: Build client (only for non-Docker jobs)
  32. if: matrix.name != 'Docker Build'
  33. run: |
  34. cd client
  35. yarn --network-timeout 100000
  36. yarn build
  37. cp -r build ../server
  38. - name: Build and Release Electron App
  39. if: matrix.name != 'Docker Build'
  40. uses: samuelmeuli/action-electron-builder@v1
  41. with:
  42. package_root: "./server"
  43. build_script_name: "build-electron"
  44. github_token: ${{ secrets.GH_TOKEN }}
  45. release: ${{ startsWith(github.ref, 'refs/tags/') }}
  46. - name: Set up Docker Buildx (only for Docker job)
  47. if: matrix.name == 'Docker Build'
  48. uses: docker/setup-buildx-action@v3
  49. - name: Login to DockerHub (only for Docker job)
  50. if: matrix.name == 'Docker Build'
  51. uses: docker/login-action@v1
  52. with:
  53. username: ${{ secrets.DOCKER_USERNAME }}
  54. password: ${{ secrets.DOCKER_PWD }}
  55. - name: Build and Push Docker Image
  56. if: matrix.name == 'Docker Build'
  57. uses: docker/build-push-action@v5
  58. with:
  59. context: .
  60. platforms: ${{ matrix.platform }}
  61. tags: |
  62. zilliz/attu:${{ github.ref_name }}
  63. zilliz/attu:v${{ env.MAJOR }}.${{ env.MINOR }}
  64. zilliz/attu:latest
  65. cache-from: type=registry,ref=zilliz/attu:cache
  66. cache-to: type=inline
  67. build-args: |
  68. VERSION=${{ github.ref_name }}
  69. push: true