Repository navigation
136 lines (115 loc) · 4.02 KB
/
Copy pathrelease.yml
File metadata and controls
136 lines (115 loc) · 4.02 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macos-13 is the Intel (x64) image: Garry's Mod on macOS is x64-only,
# and the csproj only defines the osx64 arch suffix.
# Disabled: macOS legs hang the workflow for too long.
# os: [windows-latest, ubuntu-latest, macos-13]
os: [windows-latest, ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: '11.0.x'
- name: Install Linux AOT dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev libicu-dev
- name: Cache NuGet packages
uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build native library
shell: pwsh
run: ./build-native.ps1
- name: Build AOT module
shell: pwsh
run: ./build-module.ps1 -t aot
- name: Build managed module
shell: pwsh
run: ./build-module.ps1 -t managed
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: binary-module-${{ runner.os }}
path: |
bin-aot/
bin-managed/
artifacts/runtimes/
if-no-files-found: error
retention-days: 90
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
pattern: binary-module-*
merge-multiple: false
path: release-assets
- name: Package release archives
shell: pwsh
run: |
$repoSlug = "${{ github.repository }}" -replace '/', '-'
Get-ChildItem release-assets -Directory | ForEach-Object {
$os = $_.Name -replace '^binary-module-', ''
$zip = "$repoSlug-${{ github.ref_name }}-$os.zip"
Compress-Archive -Path "$($_.FullName)/*" -DestinationPath $zip
Write-Host "Created $zip"
}
- name: Create Release
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$repoSlug = "${{ github.repository }}" -replace '/', '-'
$repoName = $repoSlug -replace '-', ' '
"## $repoName Release ${{ github.ref_name }}" | Out-File -FilePath release-notes.md -Encoding utf8
@'
### Features
- Cross-platform C# binary module for Garry's Mod
- NativeAOT and Managed build variants
- Native C library integration
### Build Variants
- **AOT**: Native compiled, no runtime dependency
- **Managed**: Cross-platform, requires .NET runtime
- **Native Libraries**: Optional C library components
### Installation
1. Download the archive for your platform
2. Extract to your Garry's Mod directory
3. Copy binary module to `lua/bin` folder
### Requirements
- Garry's Mod
- .NET 11 SDK (for managed version)
- Windows: Visual Studio 2022/2026 with C++ tools
- Linux/macOS: GCC or Clang
---
'@ | Out-File -FilePath release-notes.md -Append -Encoding utf8
$assets = Get-ChildItem "$repoSlug-${{ github.ref_name }}-*.zip" | ForEach-Object { $_.Name }
gh release create "${{ github.ref_name }}" `
$assets `
--title "${{ github.ref_name }}" `
--notes-file release-notes.md `
--generate-notes