Skip to content

Commit 70d82e5

Browse files
committed
#2 get a consistent release and versioning system going | set up workflows
1 parent 72637b5 commit 70d82e5

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pull Request Build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Build DLLs
9+
runs-on: windows-2022
10+
11+
steps:
12+
- name: Check out repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up MSBuild
16+
uses: microsoft/setup-msbuild@v2
17+
18+
- name: Build Win32 DLL
19+
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=Win32 -m
20+
21+
- name: Build x64 DLL
22+
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=x64 -m
23+
24+
- name: Verify build outputs
25+
shell: pwsh
26+
run: |
27+
$files = @(
28+
"build/x86/steam_api.dll",
29+
"build/x64/steam_api64.dll"
30+
)
31+
32+
foreach ($file in $files) {
33+
if (-not (Test-Path $file)) {
34+
throw "Missing expected build output: $file"
35+
}
36+
}

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Release DLLs
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-release:
14+
name: Build and Release
15+
runs-on: windows-2022
16+
17+
steps:
18+
- name: Check out repo
19+
uses: actions/checkout@v4
20+
21+
- name: Set up MSBuild
22+
uses: microsoft/setup-msbuild@v2
23+
24+
- name: Build x86 version (steam_api.dll)
25+
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=Win32 -m
26+
27+
- name: Build x64 version (steam_api64.dll)
28+
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=x64 -m
29+
30+
- name: Verify build outputs
31+
shell: pwsh
32+
run: |
33+
$files = @(
34+
"build/x86/steam_api.dll",
35+
"build/x64/steam_api64.dll"
36+
)
37+
38+
foreach ($file in $files) {
39+
if (-not (Test-Path $file)) {
40+
throw "Missing expected build output: $file"
41+
}
42+
}
43+
44+
- name: Package release zip
45+
shell: pwsh
46+
run: |
47+
$packageRoot = "dist/uc-online2-${{ github.ref_name }}"
48+
$archivePath = "$packageRoot.zip"
49+
50+
New-Item -ItemType Directory -Path "$packageRoot/x86" -Force | Out-Null
51+
New-Item -ItemType Directory -Path "$packageRoot/x64" -Force | Out-Null
52+
53+
Copy-Item "build/x86/steam_api.dll" "$packageRoot/x86/steam_api.dll"
54+
Copy-Item "build/x64/steam_api64.dll" "$packageRoot/x64/steam_api64.dll"
55+
56+
if (Test-Path $archivePath) {
57+
Remove-Item $archivePath -Force
58+
}
59+
60+
Compress-Archive -Path $packageRoot -DestinationPath $archivePath
61+
62+
- name: Upload workflow artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: uc-online2-${{ github.ref_name }}
66+
path: dist/uc-online2-${{ github.ref_name }}.zip
67+
if-no-files-found: error
68+
69+
- name: Publish release assets
70+
if: startsWith(github.ref, 'refs/tags/')
71+
uses: softprops/action-gh-release@v2
72+
with:
73+
tag_name: ${{ github.ref_name }}
74+
name: ${{ github.ref_name }}
75+
files: dist/uc-online2-${{ github.ref_name }}.zip
76+
generate_release_notes: true
77+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)