|
41 | 41 |
|
42 | 42 | jobs: |
43 | 43 | build_app: |
44 | | -runs-on:macos-14 |
| 44 | +runs-on:macos-latest |
45 | 45 | steps: |
46 | 46 | -name:Checkout |
47 | 47 | uses:actions/checkout@v5 |
@@ -97,12 +97,12 @@ jobs: |
97 | 97 | needs:build_app |
98 | 98 | strategy: |
99 | 99 | matrix: |
100 | | -goos:[ linux,darwin,windows ] |
| 100 | +goos:[ linux, windows ] |
101 | 101 | goarch:[ amd64, 386, arm64 ] |
102 | | -exclude: |
103 | | -# Exclude i386 ondarwin. |
104 | | - -goarch:386 |
105 | | -goos:darwin |
| 102 | +#exclude: |
| 103 | +# Exclude i386 onwindows (if needed) |
| 104 | +#- goarch: 386 |
| 105 | +#goos:windows |
106 | 106 | include: |
107 | 107 | # BEGIN Linux ARM 5 6 7 |
108 | 108 | -goos:linux |
@@ -141,7 +141,7 @@ jobs: |
141 | 141 | -name:Set up Go |
142 | 142 | uses:actions/setup-go@v5 |
143 | 143 | with: |
144 | | -go-version:^1.24.6 |
| 144 | +go-version:^1.25.0 |
145 | 145 | cache:false |
146 | 146 |
|
147 | 147 | -name:Setup environment |
@@ -301,10 +301,102 @@ jobs: |
301 | 301 |
|
302 | 302 | echo "Upload completed successfully" |
303 | 303 |
|
| 304 | +build_macos_native: |
| 305 | +runs-on:macos-latest |
| 306 | +needs:build_app |
| 307 | +strategy: |
| 308 | +matrix: |
| 309 | +goarch:[amd64, arm64] |
| 310 | +env: |
| 311 | +CGO_ENABLED:1 |
| 312 | +GOOS:darwin |
| 313 | +GOARCH:${{ matrix.goarch }} |
| 314 | +steps: |
| 315 | + -name:Checkout |
| 316 | +uses:actions/checkout@v5 |
| 317 | + |
| 318 | + -name:Set up Go |
| 319 | +uses:actions/setup-go@v5 |
| 320 | +with: |
| 321 | +go-version:^1.25.0 |
| 322 | +cache:false |
| 323 | + |
| 324 | + -name:Setup environment |
| 325 | +id:info |
| 326 | +run:| |
| 327 | + export _NAME=$(jq ".darwin[\"$GOARCH\"].name" -r < .github/build/build_info.json) |
| 328 | + export _ARTIFACT=nginx-ui-darwin-$GOARCH |
| 329 | + export _BINARY=nginx-ui |
| 330 | + echo "GOOS: darwin, GOARCH: $GOARCH, RELEASE_NAME: $_NAME, ARTIFACT_NAME: $_ARTIFACT, BINARY_NAME: $_BINARY" |
| 331 | + echo "CACHE_NAME=$_NAME" >> $GITHUB_ENV |
| 332 | + echo "DIST=nginx-ui-$_NAME" >> $GITHUB_ENV |
| 333 | + echo "ARTIFACT=$_ARTIFACT" >> $GITHUB_ENV |
| 334 | + echo "BINARY_NAME=$_BINARY" >> $GITHUB_ENV |
| 335 | +
|
| 336 | + -name:Setup Go build cache |
| 337 | +uses:actions/cache@v4 |
| 338 | +with: |
| 339 | +path:| |
| 340 | + ~/go/pkg/mod |
| 341 | + ~/.cache/go-build |
| 342 | +key:go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-${{ hashFiles('go.mod') }} |
| 343 | +restore-keys:| |
| 344 | + go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}- |
| 345 | +
|
| 346 | + -name:Download app artifacts |
| 347 | +uses:actions/download-artifact@v5 |
| 348 | +with: |
| 349 | +name:app-dist |
| 350 | +path:app/dist |
| 351 | + |
| 352 | + -name:Generate files |
| 353 | +run:go generate cmd/version/generate.go |
| 354 | + |
| 355 | + -name:Build with native CGO |
| 356 | +run:| |
| 357 | + mkdir -p dist |
| 358 | + go build -trimpath -tags=jsoniter -ldflags "-w -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o dist/$BINARY_NAME -v main.go |
| 359 | +
|
| 360 | + -name:Archive backend artifacts |
| 361 | +uses:actions/upload-artifact@v4 |
| 362 | +with: |
| 363 | +name:${{ env.ARTIFACT }} |
| 364 | +path:dist/${{ env.BINARY_NAME }} |
| 365 | + |
| 366 | + -name:Prepare publish |
| 367 | +run:| |
| 368 | + cp README*.md ./dist |
| 369 | + cd dist && tar -zcvf ../${{ env.DIST }}.tar.gz . |
| 370 | + cd .. |
| 371 | + openssl dgst -sha512 ${{ env.DIST }}.tar.gz | sed 's/([^)]*)//g' | awk '{print $NF}' >> ${{ env.DIST }}.tar.gz.digest |
| 372 | +
|
| 373 | + -name:Publish |
| 374 | +uses:softprops/action-gh-release@v2 |
| 375 | +if:github.event_name == 'release' |
| 376 | +with: |
| 377 | +files:| |
| 378 | + ${{ env.DIST }}.tar.gz |
| 379 | + ${{ env.DIST }}.tar.gz.digest |
| 380 | +
|
| 381 | + -name:Upload to R2 using S3 API |
| 382 | +if:github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' |
| 383 | +env: |
| 384 | +AWS_ACCESS_KEY_ID:${{ secrets.R2_ACCESS_KEY_ID }} |
| 385 | +AWS_SECRET_ACCESS_KEY:${{ secrets.R2_SECRET_ACCESS_KEY }} |
| 386 | +AWS_REGION:us-east-1 |
| 387 | +run:| |
| 388 | + echo "Uploading ${{ env.DIST }}.tar.gz to R2..." |
| 389 | + aws s3 cp ./${{ env.DIST }}.tar.gz s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }} |
| 390 | +
|
| 391 | + echo "Uploading ${{ env.DIST }}.tar.gz.digest to R2..." |
| 392 | + aws s3 cp ./${{ env.DIST }}.tar.gz.digest s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }} |
| 393 | +
|
| 394 | + echo "Upload completed successfully" |
| 395 | +
|
304 | 396 | docker-build: |
305 | 397 | if:github.event_name != 'pull_request' |
306 | 398 | runs-on:ubuntu-latest |
307 | | -needs:build |
| 399 | +needs:[build, build_macos_native] |
308 | 400 | env: |
309 | 401 | PLATFORMS:linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5 |
310 | 402 | steps: |
@@ -376,7 +468,7 @@ jobs: |
376 | 468 |
|
377 | 469 | update-homebrew: |
378 | 470 | runs-on:ubuntu-latest |
379 | | -needs:build |
| 471 | +needs:[build, build_macos_native] |
380 | 472 | if:github.event_name == 'release' |
381 | 473 | steps: |
382 | 474 | -name:Checkout |
@@ -556,7 +648,7 @@ jobs: |
556 | 648 |
|
557 | 649 | publish-winget: |
558 | 650 | runs-on:windows-latest |
559 | | -needs:build |
| 651 | +needs:[build, build_macos_native] |
560 | 652 | if:github.event_name == 'release' |
561 | 653 | steps: |
562 | 654 | -name:Checkout |
|