1
0

linux-release.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Linux 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: ubuntu-latest
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@v3
  20. with:
  21. fetch-depth: 0
  22. - uses: oven-sh/setup-bun@v2
  23. with:
  24. bun-version: latest
  25. - name: Build Frontend
  26. env:
  27. CI: ""
  28. run: |
  29. cd web
  30. bun install
  31. DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(git describe --tags) bun run build
  32. cd ..
  33. - name: Set up Go
  34. uses: actions/setup-go@v3
  35. with:
  36. go-version: '>=1.18.0'
  37. - name: Build Backend (amd64)
  38. run: |
  39. go mod download
  40. go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
  41. - name: Build Backend (arm64)
  42. run: |
  43. sudo apt-get update
  44. DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
  45. CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64
  46. - name: Release
  47. uses: softprops/action-gh-release@v1
  48. if: startsWith(github.ref, 'refs/tags/')
  49. with:
  50. files: |
  51. one-api
  52. one-api-arm64
  53. draft: true
  54. generate_release_notes: true
  55. env:
  56. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}