File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release Mod
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ release :
14+ runs-on : windows-latest
15+
16+ steps :
17+ - name : Check out repository
18+ uses : actions/checkout@v4
19+
20+ - name : Set up MSBuild
21+ uses : microsoft/setup-msbuild@v2
22+
23+ - name : Build mod
24+ run : msbuild src\kc-accessibility\kc-accessibility.csproj /t:Build /p:Configuration=Release
25+
26+ - name : Package staged mod
27+ shell : cmd
28+ run : scripts\package-mod.cmd
29+
30+ - name : Resolve release metadata
31+ id : release_meta
32+ shell : pwsh
33+ run : |
34+ $version = if ($env:GITHUB_REF_TYPE -eq 'tag') {
35+ $env:GITHUB_REF_NAME
36+ } else {
37+ "manual-" + $env:GITHUB_RUN_NUMBER
38+ }
39+ $asset = "kc-accessibility-$version.zip"
40+ Copy-Item "dist\kc-accessibility.zip" "dist\$asset" -Force
41+ "version=$version" >> $env:GITHUB_OUTPUT
42+ "asset_name=$asset" >> $env:GITHUB_OUTPUT
43+
44+ - name : Upload packaged mod artifact
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : ${{ steps.release_meta.outputs.asset_name }}
48+ path : dist/${{ steps.release_meta.outputs.asset_name }}
49+
50+ - name : Create GitHub release
51+ if : github.ref_type == 'tag'
52+ uses : softprops/action-gh-release@v2
53+ with :
54+ tag_name : ${{ steps.release_meta.outputs.version }}
55+ name : ${{ steps.release_meta.outputs.version }}
56+ generate_release_notes : true
57+ files : dist/${{ steps.release_meta.outputs.asset_name }}
Original file line number Diff line number Diff line change @@ -459,5 +459,8 @@ $RECYCLE.BIN/
459459# Generated staged mod output
460460mod /**
461461
462+ # Local packaged release output
463+ dist /
464+
462465# Local-only research, decompiled references, and machine-specific notes
463466local /
Original file line number Diff line number Diff line change @@ -50,6 +50,14 @@ msbuild src\kc-accessibility\kc-accessibility.csproj /t:Build /p:Configuration=D
5050
5151The post-build step stages the mod into ` mod/kc-accessibility/ ` .
5252
53+ To package the staged mod into a distributable zip, use:
54+
55+ ``` powershell
56+ cmd /c scripts\package-mod.cmd
57+ ```
58+
59+ That creates ` dist/kc-accessibility.zip ` .
60+
5361## Deploy
5462
5563Deploy the staged mod with:
@@ -58,6 +66,22 @@ Deploy the staged mod with:
5866cmd /c scripts\deploy-mod-to-game.cmd
5967```
6068
69+ ## Releases
70+
71+ GitHub Actions builds and releases the mod on Windows when you push a tag that starts with ` v ` , for example:
72+
73+ ``` powershell
74+ git tag v1.0.0
75+ git push origin v1.0.0
76+ ```
77+
78+ The workflow:
79+
80+ - builds ` src\kc-accessibility\kc-accessibility.csproj ` in ` Release `
81+ - stages ` mod/kc-accessibility/ `
82+ - zips that staged mod folder
83+ - publishes the zip as a GitHub release asset
84+
6185## Repository Layout
6286
6387- ` src/kc-accessibility/ ` mod source
Original file line number Diff line number Diff line change @@ -16,12 +16,16 @@ if not exist "%SOURCE_MOD_DIR%" (
1616
1717if not exist " %TARGET_MOD_DIR% " mkdir " %TARGET_MOD_DIR% "
1818
19+ for %%F in (" %TARGET_MOD_DIR% \*" ) do (
20+ if /I not " %%~aF " == " d" del /F /Q " %%~fF " > nul
21+ )
22+
1923for %%F in (" %SOURCE_MOD_DIR% \*" ) do (
2024 if /I not " %%~aF " == " d" copy /Y " %%~fF " " %TARGET_MOD_DIR% \%%~nxF " > nul
2125)
2226
2327if exist " %TARGET_MOD_DIR% \output.txt" del /F /Q " %TARGET_MOD_DIR% \output.txt"
2428
25- echo Deployed staged mod files to " %TARGET_MOD_DIR% "
29+ echo Mirrored staged mod files to " %TARGET_MOD_DIR% "
2630echo Cleared " %TARGET_MOD_DIR% \output.txt"
2731exit /b 0
Original file line number Diff line number Diff line change 1+ @ echo off
2+ setlocal
3+
4+ set " REPO_ROOT = %~dp0 .."
5+ for %%I in (" %REPO_ROOT% " ) do set " REPO_ROOT = %%~fI "
6+
7+ set " PROJECT_DIR = %REPO_ROOT% \src\kc-accessibility\"
8+ set " MOD_NAME = kc-accessibility"
9+ set " STAGE_ROOT = %REPO_ROOT% \mod"
10+ set " MOD_ROOT = %STAGE_ROOT% \%MOD_NAME% "
11+ set " DIST_ROOT = %REPO_ROOT% \dist"
12+ set " ZIP_PATH = %DIST_ROOT% \%MOD_NAME% .zip"
13+
14+ if not exist " %PROJECT_DIR% kc-accessibility.csproj" (
15+ echo Project file not found under " %PROJECT_DIR% "
16+ exit /b 1
17+ )
18+
19+ call " %~dp0 stage-mod.cmd" " %PROJECT_DIR% "
20+ if errorlevel 1 exit /b 1
21+
22+ if not exist " %DIST_ROOT% " mkdir " %DIST_ROOT% "
23+ if exist " %ZIP_PATH% " del /F /Q " %ZIP_PATH% "
24+
25+ powershell -NoProfile -ExecutionPolicy Bypass -Command " Compress-Archive -Path '%MOD_ROOT% \*' -DestinationPath '%ZIP_PATH% ' -Force"
26+ if errorlevel 1 exit /b 1
27+
28+ echo Packaged mod zip at " %ZIP_PATH% "
29+ exit /b 0
You can’t perform that action at this time.
0 commit comments