mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-28 13:13:00 +00:00
macOS build workflow
This commit is contained in:
parent
511684d289
commit
a6ca391ba1
1 changed files with 90 additions and 0 deletions
90
.github/workflows/release.yml
vendored
90
.github/workflows/release.yml
vendored
|
|
@ -151,6 +151,96 @@ jobs:
|
||||||
overwrite: true
|
overwrite: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
|
# =================================
|
||||||
|
# macOS Build (darwin)
|
||||||
|
# =================================
|
||||||
|
build-macos:
|
||||||
|
name: Build for macOS
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: amd64
|
||||||
|
runner: macos-13
|
||||||
|
- arch: arm64
|
||||||
|
runner: macos-14
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Build 3X-UI for macOS (CGO)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export GOOS=darwin
|
||||||
|
export GOARCH=${{ matrix.arch }}
|
||||||
|
|
||||||
|
go version
|
||||||
|
go env GOOS GOARCH CGO_ENABLED
|
||||||
|
|
||||||
|
go build -ldflags "-w -s" -o xui-release -v main.go
|
||||||
|
file xui-release
|
||||||
|
|
||||||
|
mkdir -p x-ui/bin
|
||||||
|
cp xui-release x-ui/x-ui
|
||||||
|
cp x-ui.sh x-ui/
|
||||||
|
|
||||||
|
# Download dependencies
|
||||||
|
cd x-ui/bin
|
||||||
|
Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v26.1.18/"
|
||||||
|
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||||
|
curl -fsSL -o Xray-macos-64.zip "${Xray_URL}Xray-macos-64.zip"
|
||||||
|
unzip -q Xray-macos-64.zip
|
||||||
|
rm -f Xray-macos-64.zip
|
||||||
|
elif [ "${{ matrix.arch }}" = "arm64" ]; then
|
||||||
|
curl -fsSL -o Xray-macos-arm64-v8a.zip "${Xray_URL}Xray-macos-arm64-v8a.zip"
|
||||||
|
unzip -q Xray-macos-arm64-v8a.zip
|
||||||
|
rm -f Xray-macos-arm64-v8a.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f geoip.dat geosite.dat
|
||||||
|
curl -fsSL -o geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||||
|
curl -fsSL -o geosite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||||
|
curl -fsSL -o geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
|
||||||
|
curl -fsSL -o geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
||||||
|
curl -fsSL -o geoip_RU.dat https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||||
|
curl -fsSL -o geosite_RU.dat https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||||
|
|
||||||
|
mv xray xray-macos-${{ matrix.arch }}
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
shell: bash
|
||||||
|
run: tar -zcvf x-ui-darwin-${{ matrix.arch }}.tar.gz x-ui
|
||||||
|
|
||||||
|
- name: Upload files to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: x-ui-darwin-${{ matrix.arch }}
|
||||||
|
path: ./x-ui-darwin-${{ matrix.arch }}.tar.gz
|
||||||
|
|
||||||
|
- name: Upload files to GH release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'release' && github.event.action == 'published') ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
file: x-ui-darwin-${{ matrix.arch }}.tar.gz
|
||||||
|
asset_name: x-ui-darwin-${{ matrix.arch }}.tar.gz
|
||||||
|
overwrite: true
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
# =================================
|
# =================================
|
||||||
# Windows Build
|
# Windows Build
|
||||||
# =================================
|
# =================================
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue