linux-release.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Linux Release
  2. on:
  3. push:
  4. tags:
  5. - '*'
  6. jobs:
  7. release:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v3
  12. with:
  13. fetch-depth: 0
  14. - uses: actions/setup-node@v3
  15. with:
  16. node-version: 16
  17. - name: Build Frontend
  18. env:
  19. CI: ""
  20. run: |
  21. cd web
  22. npm install
  23. REACT_APP_VERSION=$(git describe --tags) npm run build
  24. cd ..
  25. - name: Set up Go
  26. uses: actions/setup-go@v3
  27. with:
  28. go-version: '>=1.18.0'
  29. - name: Build Backend (amd64)
  30. run: |
  31. go mod download
  32. go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template
  33. - name: Build Backend (arm64)
  34. run: |
  35. sudo apt-get update
  36. sudo apt-get install gcc-aarch64-linux-gnu
  37. CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template-arm64
  38. - name: Release
  39. uses: softprops/action-gh-release@v1
  40. if: startsWith(github.ref, 'refs/tags/')
  41. with:
  42. files: |
  43. gin-template
  44. gin-template-arm64
  45. env:
  46. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}