macOS Build and Release #5
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: macOS Build and Release | |
| on: | |
| push: | |
| tags: ['v*'] # 仅在标签推送时触发 | |
| workflow_dispatch: # 允许手动触发 | |
| jobs: | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25' | |
| - name: Install V | |
| run: | | |
| git clone --depth=1 https://github.com/vlang/v | |
| cd v | |
| make | |
| sudo ./v symlink | |
| v version | |
| - name: Install libgo dependency | |
| run: v install KingBes.libgo | |
| - name: Prebuild Go components | |
| run: | | |
| script_path="$HOME/.vmodules/kingbes/libgo/go/build.sh" | |
| chmod +x "$script_path" | |
| "$script_path" | |
| - name: Build project | |
| run: v -native -cc gcc -os macos -o bny . | |
| - name: Verify binary | |
| run: | | |
| file bny | |
| ./bny -v || true # 即使版本检查失败也继续 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bny-macos | |
| path: bny | |
| if-no-files-found: error | |