Repository navigation
109 lines (93 loc) · 3.26 KB
/
Copy pathbuild.yml
File metadata and controls
109 lines (93 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Build
on:
push:
branches: [master, develop]
tags: ["v*.*.*"]
pull_request:
paths-ignore: ["**/*.md", "doc/**"]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install premake5
shell: pwsh
run: |
$version = "5.0.0-beta8"
$dst = "$env:RUNNER_TEMP\premake"
New-Item -ItemType Directory -Force -Path $dst | Out-Null
$zip = "$dst\premake.zip"
Invoke-WebRequest -Uri "https://github.com/premake/premake-core/releases/download/v$version/premake-$version-windows.zip" -OutFile $zip
Expand-Archive -Path $zip -DestinationPath $dst -Force
Add-Content -Path $env:GITHUB_PATH -Value $dst
- name: Install v141_xp toolset
shell: cmd
run: |
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\setup.exe" modify ^
--passive --norestart ^
--installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
--add Microsoft.VisualStudio.Component.WinXP
- uses: microsoft/setup-msbuild@v2
- name: Add pdbcopy to PATH
run: echo "${env:ProgramFiles(x86)}\Windows Kits\10\Debuggers\x86" >> $env:GITHUB_PATH
- name: Build
env:
CL: /MP
run: |
if ("${{ github.ref }}" -like "refs/tags/v*") {
premake5 --file=release.lua prepare --toolset=vs2022 --final-release
} else {
premake5 --file=release.lua prepare --toolset=vs2022
}
- uses: actions/upload-artifact@v4
with:
name: modloader-${{ github.sha }}
path: release
include-hidden-files: true
if-no-files-found: error
retention-days: 30
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: modloader-${{ github.sha }}
path: dist/
- name: Package zip files
run: |
(cd dist/binaries && zip -r ../modloader.zip .)
(cd dist/symbols && zip -r ../pdb-symbols.zip .)
- name: Prepare release notes
env:
TAG: ${{ github.ref_name }}
run: |
python3 <<'PY'
import os, re, sys
tag = os.environ["TAG"]
lines = open("doc/CHANGELOG.md").readlines()
i = next((i for i, l in enumerate(lines) if l.startswith(tag + " ")), None)
if i is None:
sys.exit(f"No changelog for {tag} in CHANGELOG.md")
j = next((j for j in range(i + 1, len(lines)) if re.match(r"^v\d+\.\d+", lines[j])), len(lines))
open("release-body.md", "w").writelines(lines[i:j])
PY
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Mod Loader ${{ github.ref_name }}
body_path: release-body.md
files: |
dist/modloader.zip
dist/pdb-symbols.zip
fail_on_unmatched_files: true