This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build MyPlugin | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Haxe 4.3.6 | ||
shell: powershell | ||
run: | | ||
Start-Process -FilePath "install/haxe-4.3.6-win64.exe" -ArgumentList "/S" -Wait # Silent install | ||
-name: Check Haxe Installation | ||
shell: powershell | ||
run: | | ||
if (!(Test-Path -Path "C:\HaxeToolkit\haxe\")) { | ||
Write-Error "Haxe installation directory not found!" | ||
exit 1 | ||
} else { | ||
Write-Host "Haxe installation directory found." | ||
} | ||
- name: Add Haxe to PATH | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' # 选择任意 Python 版本 | ||
env: | | ||
PATH=${{ env.PATH }}:C:\HaxeToolkit\haxe\ # 将 Haxe 路径添加到 PATH | ||
- name: Run Haxe build | ||
shell: powershell | ||
run: | | ||
$env:PATH = "C:\HaxeToolkit\haxe\;$env:PATH" # 添加 Haxe 和 haxelib 路径到 PATH | ||
haxe build.hxml | ||
- name: Install CMake | ||
uses: jwlawson/actions-setup-cmake@v2 | ||
with: | ||
cmake-version: 'latest' | ||
architecture: x64 | ||
- name: Create Build Directory | ||
run: mkdir build | ||
- name: Configure CMake | ||
shell: powershell | ||
working-directory: build | ||
run: cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" | ||
- name: Build Project | ||
shell: powershell | ||
working-directory: build | ||
run: cmake --build . --config Release | ||
- name: Upload Release Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: MyPlugin | ||
path: build/Release/MyPlugin.exe | ||
- name: Release | ||
if: startsWith(github.ref, 'refs/tags/') # Only run on tag releases | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: build/Release/MyPlugin.exe | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |