敏感搜索优化 #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21.0' # 使用完整版本号 | |
| check-latest: true # 检查最新补丁版本 | |
| - name: Verify Go installation | |
| run: | | |
| go version | |
| go env | |
| - name: Tidy and verify modules | |
| run: | | |
| go mod tidy | |
| go mod verify | |
| - name: Build for Linux (amd64) | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ | |
| -ldflags="-w -s" \ | |
| -trimpath \ | |
| -o Rshell_linux_amd64 main.go | |
| - name: Build for Windows (amd64) | |
| run: | | |
| CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \ | |
| -ldflags="-w -s" \ | |
| -trimpath \ | |
| -o Rshell_windows_amd64.exe main.go | |
| - name: Build for macOS (amd64) | |
| run: | | |
| CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build \ | |
| -ldflags="-w -s" \ | |
| -trimpath \ | |
| -o Rshell_darwin_amd64 main.go | |
| - name: Build for macOS (arm64) | |
| run: | | |
| CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build \ | |
| -ldflags="-w -s" \ | |
| -trimpath \ | |
| -o Rshell_darwin_arm64 main.go | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| Rshell_linux_amd64 | |
| Rshell_windows_amd64.exe | |
| Rshell_darwin_amd64 | |
| Rshell_darwin_arm64 | |
| generate_release_notes: true | |
| name: Release ${{ github.ref_name }} |