release.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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]
  12. steps:
  13. - name: Check out Git repository
  14. uses: actions/checkout@v4
  15. - name: Install Node.js, NPM, and Yarn
  16. uses: actions/setup-node@v4
  17. with:
  18. node-version: 22
  19. - name: Build client (only for non-Docker jobs)
  20. run: |
  21. cd client
  22. yarn --network-timeout 100000
  23. yarn build
  24. cp -r build ../server
  25. - name: Build and Release Electron App
  26. uses: samuelmeuli/action-electron-builder@v1
  27. with:
  28. package_root: "./server"
  29. build_script_name: "build-electron"
  30. github_token: ${{ secrets.GH_TOKEN }}
  31. release: ${{ startsWith(github.ref, 'refs/tags/') }}
  32. # Job to build each Docker platform separately
  33. docker_build:
  34. runs-on: ubuntu-latest
  35. strategy:
  36. matrix:
  37. platform: [linux/amd64, linux/arm64, linux/arm/v7]
  38. steps:
  39. - name: Check out Git repository
  40. uses: actions/checkout@v4
  41. - name: Set up Docker Buildx
  42. uses: docker/setup-buildx-action@v3
  43. - name: Login to DockerHub
  44. uses: docker/login-action@v1
  45. with:
  46. username: ${{ secrets.DOCKER_USERNAME }}
  47. password: ${{ secrets.DOCKER_PWD }}
  48. - name: Build and Push Docker Image for ${{ matrix.platform }}
  49. uses: docker/build-push-action@v5
  50. with:
  51. context: .
  52. platforms: ${{ matrix.platform }}
  53. tags: |
  54. zilliz/attu:${{ github.ref_name }}-${{ matrix.platform }}
  55. build-args: |
  56. VERSION=${{ github.ref_name }}
  57. push: true
  58. # Job to combine platform-specific tags into one multi-platform tag
  59. docker_manifest:
  60. needs: docker_build
  61. runs-on: ubuntu-latest
  62. steps:
  63. - name: Install Docker CLI
  64. run: sudo apt-get update && sudo apt-get install -y docker.io
  65. - name: Login to DockerHub
  66. uses: docker/login-action@v1
  67. with:
  68. username: ${{ secrets.DOCKER_USERNAME }}
  69. password: ${{ secrets.DOCKER_PWD }}
  70. - name: Create and Push Docker Manifest
  71. run: |
  72. docker manifest create zilliz/attu:${{ github.ref_name }} \
  73. --amend zilliz/attu:${{ github.ref_name }}-linux/amd64 \
  74. --amend zilliz/attu:${{ github.ref_name }}-linux/arm64 \
  75. --amend zilliz/attu:${{ github.ref_name }}-linux/arm/v7
  76. docker manifest push zilliz/attu:${{ github.ref_name }}