|
93 | 93 | - { os: windows, arch: "386", legacy_win7: true, legacy_name: "windows-7" } |
94 | 94 | - { os: windows, arch: arm64 } |
95 | 95 |
|
96 | | - - { os: darwin, arch: amd64 } |
97 | | - - { os: darwin, arch: arm64 } |
98 | | - - { os: darwin, arch: amd64, legacy_go124: true, legacy_name: "macos-11" } |
99 | | - |
100 | 96 | - { os: android, arch: arm64, ndk: "aarch64-linux-android21" } |
101 | 97 | - { os: android, arch: arm, ndk: "armv7a-linux-androideabi21" } |
102 | 98 | - { os: android, arch: amd64, ndk: "x86_64-linux-android21" } |
@@ -146,7 +142,7 @@ jobs: |
146 | 142 | - name: Set build tags |
147 | 143 | run: | |
148 | 144 | set -xeuo pipefail |
149 | | - TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,badlinkname,tfogo_checklinkname0' |
| 145 | + TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,badlinkname,tfogo_checklinkname0' |
150 | 146 | echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}" |
151 | 147 | - name: Build |
152 | 148 | if: matrix.os != 'android' |
@@ -285,6 +281,77 @@ jobs: |
285 | 281 | with: |
286 | 282 | name: binary-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.goarm && format('v{0}', matrix.goarm) }}${{ matrix.go386 && format('_{0}', matrix.go386) }}${{ matrix.gomips && format('_{0}', matrix.gomips) }}${{ matrix.legacy_name && format('-legacy-{0}', matrix.legacy_name) }} |
287 | 283 | path: "dist" |
| 284 | + build_darwin: |
| 285 | + name: Build Darwin binaries |
| 286 | + if: github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Binary' |
| 287 | + runs-on: macos-latest |
| 288 | + needs: |
| 289 | + - calculate_version |
| 290 | + strategy: |
| 291 | + matrix: |
| 292 | + include: |
| 293 | + - { arch: amd64 } |
| 294 | + - { arch: arm64 } |
| 295 | + - { arch: amd64, legacy_go124: true, legacy_name: "macos-11" } |
| 296 | + steps: |
| 297 | + - name: Checkout |
| 298 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 299 | + with: |
| 300 | + fetch-depth: 0 |
| 301 | + - name: Setup Go |
| 302 | + if: ${{ ! matrix.legacy_go124 }} |
| 303 | + uses: actions/setup-go@v5 |
| 304 | + with: |
| 305 | + go-version: ^1.25.3 |
| 306 | + - name: Setup Go 1.24 |
| 307 | + if: matrix.legacy_go124 |
| 308 | + uses: actions/setup-go@v5 |
| 309 | + with: |
| 310 | + go-version: ~1.24.6 |
| 311 | + - name: Set tag |
| 312 | + run: |- |
| 313 | + git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV" |
| 314 | + git tag v${{ needs.calculate_version.outputs.version }} -f |
| 315 | + - name: Set build tags |
| 316 | + run: | |
| 317 | + set -xeuo pipefail |
| 318 | + TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,badlinkname,tfogo_checklinkname0' |
| 319 | + echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}" |
| 320 | + - name: Build |
| 321 | + run: | |
| 322 | + set -xeuo pipefail |
| 323 | + mkdir -p dist |
| 324 | + go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \ |
| 325 | + -ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \ |
| 326 | + ./cmd/sing-box |
| 327 | + env: |
| 328 | + CGO_ENABLED: "1" |
| 329 | + GOOS: darwin |
| 330 | + GOARCH: ${{ matrix.arch }} |
| 331 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 332 | + - name: Set name |
| 333 | + run: |- |
| 334 | + DIR_NAME="sing-box-${{ needs.calculate_version.outputs.version }}-darwin-${{ matrix.arch }}" |
| 335 | + if [[ -n "${{ matrix.legacy_name }}" ]]; then |
| 336 | + DIR_NAME="${DIR_NAME}-legacy-${{ matrix.legacy_name }}" |
| 337 | + fi |
| 338 | + echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}" |
| 339 | + - name: Archive |
| 340 | + run: | |
| 341 | + set -xeuo pipefail |
| 342 | + cd dist |
| 343 | + mkdir -p "${DIR_NAME}" |
| 344 | + cp ../LICENSE "${DIR_NAME}" |
| 345 | + cp sing-box "${DIR_NAME}" |
| 346 | + tar -czvf "${DIR_NAME}.tar.gz" "${DIR_NAME}" |
| 347 | + rm -r "${DIR_NAME}" |
| 348 | + - name: Cleanup |
| 349 | + run: rm dist/sing-box |
| 350 | + - name: Upload artifact |
| 351 | + uses: actions/upload-artifact@v4 |
| 352 | + with: |
| 353 | + name: binary-darwin_${{ matrix.arch }}${{ matrix.legacy_name && format('-legacy-{0}', matrix.legacy_name) }} |
| 354 | + path: "dist" |
288 | 355 | build_android: |
289 | 356 | name: Build Android |
290 | 357 | if: github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Android' |
@@ -619,6 +686,7 @@ jobs: |
619 | 686 | needs: |
620 | 687 | - calculate_version |
621 | 688 | - build |
| 689 | + - build_darwin |
622 | 690 | - build_android |
623 | 691 | - build_apple |
624 | 692 | steps: |
|
0 commit comments