windows-release.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Windows Release
  2. permissions:
  3. contents: write
  4. on:
  5. workflow_dispatch:
  6. inputs:
  7. name:
  8. description: 'reason'
  9. required: false
  10. push:
  11. tags:
  12. - '*'
  13. - '!*-alpha*'
  14. jobs:
  15. release:
  16. runs-on: windows-latest
  17. defaults:
  18. run:
  19. shell: bash
  20. steps:
  21. - name: Checkout
  22. uses: actions/checkout@v3
  23. with:
  24. fetch-depth: 0
  25. - uses: oven-sh/setup-bun@v2
  26. with:
  27. bun-version: latest
  28. - name: Build Frontend
  29. env:
  30. CI: ""
  31. run: |
  32. cd web
  33. bun install
  34. DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(git describe --tags) bun run build
  35. cd ..
  36. - name: Set up Go
  37. uses: actions/setup-go@v3
  38. with:
  39. go-version: '>=1.18.0'
  40. - name: Build Backend
  41. run: |
  42. go mod download
  43. VERSION=$(git describe --tags)
  44. go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
  45. - name: Release
  46. uses: softprops/action-gh-release@v2
  47. if: startsWith(github.ref, 'refs/tags/')
  48. with:
  49. files: new-api-*.exe
  50. draft: true
  51. generate_release_notes: true
  52. env:
  53. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}