Files
WowPresence/.github/workflows/build.yml
T

103 lines
3.5 KiB
YAML

name: Build WowPresence
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: write
concurrency:
group: wowpresence-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: windows-2025
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure x86 MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Build native components
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "dist" | Out-Null
cl /nologo /O2 /MT /W3 /LD "src\WowPresence.c" /Fe:"dist\WowPresence.dll" /link /INCREMENTAL:NO
if ($LASTEXITCODE -ne 0) { throw "WowPresence.dll build failed" }
cl /nologo /O2 /MT /W3 "src\WowPresenceLauncher.c" user32.lib /Fe:"dist\WowPresence.exe" /link /SUBSYSTEM:WINDOWS /INCREMENTAL:NO
if ($LASTEXITCODE -ne 0) { throw "WowPresence.exe build failed" }
if (-not (Test-Path "dist\WowPresence.dll")) { throw "WowPresence.dll missing" }
if (-not (Test-Path "dist\WowPresence.exe")) { throw "WowPresence.exe missing" }
- name: Create ready-to-install package
shell: pwsh
run: |
$package = "package"
$config = Join-Path $package "WowPresence"
New-Item -ItemType Directory -Force -Path $config | Out-Null
Copy-Item "dist\WowPresence.dll" (Join-Path $package "WowPresence.dll")
Copy-Item "dist\WowPresence.exe" (Join-Path $package "WowPresence.exe")
Copy-Item "config\discord_application_id" (Join-Path $config "discord_application_id")
Copy-Item "config\discord_broadcast_flags" (Join-Path $config "discord_broadcast_flags")
$zip = "dist\WowPresence.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path (Join-Path $package "WowPresence.dll"),(Join-Path $package "WowPresence.exe"),(Join-Path $package "WowPresence") -DestinationPath $zip -CompressionLevel Optimal
if (-not (Test-Path $zip)) { throw "WowPresence.zip missing" }
- name: Upload build artifact
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: WowPresence-build
path: |
dist/WowPresence.dll
dist/WowPresence.exe
dist/WowPresence.zip
if-no-files-found: error
- name: Create GitHub Release v1.2
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v1.2' }}
uses: softprops/action-gh-release@v3
with:
tag_name: v1.2
target_commitish: ${{ github.sha }}
files: |
dist/WowPresence.dll
dist/WowPresence.exe
dist/WowPresence.zip
fail_on_unmatched_files: true
name: "WowPresence v1.2"
body_path: RELEASE_NOTES.md
generate_release_notes: true
make_latest: true
- name: Create GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v3
with:
files: |
dist/WowPresence.dll
dist/WowPresence.exe
dist/WowPresence.zip
fail_on_unmatched_files: true
name: "WowPresence ${{ github.ref_name }}"
generate_release_notes: true
make_latest: true