Skip to content

Commit 2cf2c1a

Browse files
committed
ci: Implement multi-platform release build and publish workflow via GitHub Actions.
1 parent ea7dab4 commit 2cf2c1a

1 file changed

Lines changed: 54 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,46 @@ jobs:
4848
4949
- name: Install LLVM (Windows)
5050
if: matrix.os == 'windows-latest'
51+
shell: pwsh
5152
run: |
52-
choco install llvm -y
53-
echo "C:/Program Files/LLVM/bin" >> $GITHUB_PATH
54-
echo "LLVM_DIR=C:/Program Files/LLVM/lib/cmake/llvm" >> $GITHUB_ENV
55-
echo "LLVM_ROOT=C:/Program Files/LLVM" >> $GITHUB_ENV
53+
choco install llvm --version 17.0.6 -y --force
54+
$llvmRoot = "C:\Program Files\LLVM"
55+
if (-not (Test-Path $llvmRoot)) { $llvmRoot = "C:\Program Files (x86)\LLVM" }
56+
57+
$llvmDir = ""
58+
$candidates = @("$llvmRoot\lib\cmake\llvm", "$llvmRoot\share\llvm\cmake", "$llvmRoot\lib\llvm\cmake", "$llvmRoot\cmake")
59+
foreach ($c in $candidates) {
60+
if (Test-Path "$c\LLVMConfig.cmake") { $llvmDir = $c; break }
61+
}
62+
63+
if (-not $llvmDir -and (Test-Path "C:\Program Files\LLVM\lib\cmake\llvm")) {
64+
$llvmDir = "C:\Program Files\LLVM\lib\cmake\llvm"
65+
}
66+
67+
if ($llvmDir) {
68+
$llvmDir = $llvmDir -replace "\\", "/"
69+
$llvmRoot = $llvmRoot -replace "\\", "/"
70+
Add-Content $env:GITHUB_PATH "$llvmRoot/bin"
71+
Add-Content $env:GITHUB_ENV "LLVM_DIR=$llvmDir"
72+
Add-Content $env:GITHUB_ENV "LLVM_ROOT=$llvmRoot"
73+
} else {
74+
exit 1
75+
}
5676
57-
- name: Configure CMake
77+
- name: Configure (Unix)
78+
if: matrix.os != 'windows-latest'
5879
shell: bash
5980
run: |
60-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
61-
-DCMAKE_PREFIX_PATH="C:/Program Files/LLVM" \
62-
-DLLVM_DIR="C:/Program Files/LLVM/lib/cmake/llvm"
81+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
82+
83+
- name: Configure (Windows)
84+
if: matrix.os == 'windows-latest'
85+
shell: pwsh
86+
run: |
87+
cmake -S . -B build `
88+
-DCMAKE_BUILD_TYPE=Release `
89+
-DLLVM_DIR="$env:LLVM_DIR" `
90+
-DCMAKE_PREFIX_PATH="$env:LLVM_ROOT"
6391
6492
- name: Build
6593
shell: bash
@@ -77,18 +105,28 @@ jobs:
77105
exit 1
78106
fi
79107
80-
- name: Rename Binary
81-
shell: bash
82-
run: |
83-
mv "${{ matrix.binary_path }}" ${{ matrix.asset_name }}
84-
85108
- name: Build Installer (Windows)
86109
if: matrix.os == 'windows-latest'
87-
shell: cmd
110+
shell: pwsh
88111
run: |
89-
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" setup.iss
90-
dir build
112+
choco install innosetup -y
113+
New-Item -ItemType Directory -Force -Path bin
114+
Copy-Item "build/Release/proxpl.exe" -Destination "bin/"
115+
Copy-Item "build/Release/prm.exe" -Destination "bin/"
116+
if (Test-Path "build/Release/proxpl_lib.dll") {
117+
Copy-Item "build/Release/proxpl_lib.dll" -Destination "bin/"
118+
}
119+
ISCC setup.iss
120+
Get-ChildItem -Path build
91121
122+
- name: Rename Binary
123+
shell: bash
124+
run: |
125+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
126+
cp "${{ matrix.binary_path }}" ${{ matrix.asset_name }}
127+
else
128+
mv "${{ matrix.binary_path }}" ${{ matrix.asset_name }}
129+
fi
92130
93131
- name: Upload Artifact
94132
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)