1+ name : Build Binaries
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ tags :
7+ - ' v*'
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ build :
14+ strategy :
15+ # Prevent race conditions with multiple releases
16+ max-parallel : 1
17+ matrix :
18+ os : [
19+ { name: "windows", image: "windows-latest" },
20+ { name: "linux", image: "ubuntu-22.04" },
21+ { name: "macos-intel", image: "macos-13" },
22+ { name: "macos", image: "macos-latest" },
23+ ]
24+ runs-on : ${{ matrix.os.image }}
25+ steps :
26+ - name : Checkout code
27+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
29+ - name : Setup Node.js
30+ uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
31+ with :
32+ node-version : 20
33+ cache : npm
34+ cache-dependency-path : package-lock.json
35+
36+ - name : Clean up
37+ run : |
38+ rm -rf node_modules package-lock.json || true
39+ npm cache clean --force || true
40+
41+ - name : Install dependencies
42+ run : npm ci --no-audit --no-fund --progress=false
43+
44+ - name : Add macOS certificate
45+ if : contains(matrix.os.name, 'macos')
46+ env :
47+ MACOS_CERT_P12 : ${{ secrets.MACOS_CERT_P12 }}
48+ MACOS_CERT_PASSWORD : ${{ secrets.MACOS_CERT_PASSWORD }}
49+ run : chmod +x tools/add-macos-cert.sh && . ./tools/add-macos-cert.sh
50+
51+ # Windows certificate setup
52+ - name : Set up certificate (Windows)
53+ if : contains(matrix.os.name, 'windows')
54+ run : |
55+ echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
56+ shell : bash
57+
58+ - name : Set Windows signing variables
59+ if : contains(matrix.os.name, 'windows')
60+ id : variables
61+ run : |
62+ echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
63+ echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
64+ echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
65+ echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
66+ shell : bash
67+
68+ - name : Code signing with Software Trust Manager (Windows)
69+ if : contains(matrix.os.name, 'windows')
70+ 71+
72+ - name : Sync certificate (Windows)
73+ if : contains(matrix.os.name, 'windows')
74+ run : |
75+ smctl windows certsync --keypair-alias=${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
76+ shell : bash
77+
78+ - name : Build binaries
79+ env :
80+ NODE_OPTIONS : " --max-old-space-size=4096"
81+ SM_CODE_SIGNING_CERT_SHA1_HASH : ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
82+ APPLE_TEAM_ID : ${{ secrets.APPLE_TEAM_ID }}
83+ APPLE_ID : ${{ secrets.APPLE_ID }}
84+ APPLE_PASSWORD : ${{ secrets.APPLE_PASSWORD }}
85+ run : npm run make
86+
87+ - name : Upload binaries
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : AliFullStack-${{ matrix.os.name }}-${{ github.run_number }}
91+ path : out/make/
92+ retention-days : 30
93+
94+ verify-artifacts :
95+ name : Verify Build Artifacts
96+ needs : build
97+ runs-on : ubuntu-latest
98+ steps :
99+ - name : Checkout code
100+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
101+
102+ - name : Setup Node.js
103+ uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
104+ with :
105+ node-version : 20
106+
107+ - name : Download all artifacts
108+ uses : actions/download-artifact@v4
109+ with :
110+ path : artifacts/
111+
112+ - name : List all downloaded artifacts
113+ run : |
114+ echo "Build artifacts:"
115+ find artifacts/ -type f -name "*.zip" -o -name "*.exe" -o -name "*.deb" -o -name "*.rpm" | sort
116+
117+ - name : Verify expected binaries exist
118+ run : |
119+ # Check for Windows binary
120+ if [ ! -f "artifacts/AliFullStack-windows-${{ github.run_number }}/zip/win32/x64/AliFullStack-win32-x64-*.zip" ]; then
121+ echo "❌ Windows binary not found"
122+ exit 1
123+ fi
124+
125+ # Check for Linux binaries
126+ if [ ! -f "artifacts/AliFullStack-linux-${{ github.run_number }}/zip/linux/x64/AliFullStack-linux-x64-*.zip" ]; then
127+ echo "❌ Linux ZIP binary not found"
128+ exit 1
129+ fi
130+
131+ # Check for macOS binaries
132+ if [ ! -f "artifacts/AliFullStack-macos-${{ github.run_number }}/zip/darwin/x64/AliFullStack-darwin-x64-*.zip" ] && \
133+ [ ! -f "artifacts/AliFullStack-macos-intel-${{ github.run_number }}/zip/darwin/x64/AliFullStack-darwin-x64-*.zip" ]; then
134+ echo "❌ macOS binary not found"
135+ exit 1
136+ fi
137+
138+ echo "✅ All expected binaries found:"
139+ find artifacts/ -type f \( -name "*.zip" -o -name "*.exe" -o -name "*.deb" -o -name "*.rpm" \) -exec basename {} \;
0 commit comments