-
Notifications
You must be signed in to change notification settings - Fork 32
142 lines (137 loc) · 4.75 KB
/
CD.yml
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
137
138
139
140
141
142
name: CD
on:
push:
tags: '*'
jobs:
build-lin:
name: Linux Build
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++-10-multilib
- name: Build
env:
RELEASE_BUILD: 1
DEMO_SIGN_PUBKEY: ${{ secrets.SAR_DEMO_SIGN_PUBKEY }}
DEMO_SIGN_PRIVKEY: ${{ secrets.SAR_DEMO_SIGN_PRIVKEY }}
run: make -j$(nproc)
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: sar-linux
path: sar.so
if-no-files-found: error
- name: Upload to dl.sar.portal2.sr
if: github.repository_owner == 'p2sr'
env:
DL_SAR_API_TOKEN: ${{ secrets.DL_SAR_API_TOKEN }}
run: |
SAR_VERSION=$(git describe --tags)
curl -X "POST" \
-H "Authorization: Bearer $DL_SAR_API_TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "version=$(echo $SAR_VERSION | awk -F- '{print $1}')" \
-F "sar_version=$SAR_VERSION" \
-F "system=linux" \
-F "commit=$GITHUB_SHA" \
-F "branch=$GITHUB_REF_NAME" \
-F "count=1" \
-F "hashes[0]=$(sha256sum sar.so | cut -d ' ' -f 1)" \
-F "files[0][email protected]" \
"https://dl.sar.portal2.sr/api/v1/upload"
build-win:
name: Windows Build
runs-on: windows-2019
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build
env:
RELEASE_BUILD: 1
DEMO_SIGN_PUBKEY: ${{ secrets.SAR_DEMO_SIGN_PUBKEY }}
DEMO_SIGN_PRIVKEY: ${{ secrets.SAR_DEMO_SIGN_PRIVKEY }}
run: msbuild -m -t:SourceAutoRecord -p:"Configuration=Release;Platform=x86" SourceAutoRecord.sln
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: sar-windows
path: bin\sar.dll
if-no-files-found: error
- name: Upload PDB Artifact
uses: actions/upload-artifact@v4
with:
name: sar-windows-pdb
path: bin\sar.pdb
if-no-files-found: error
- name: Upload to dl.sar.portal2.sr
if: github.repository_owner == 'p2sr'
shell: bash
env:
DL_SAR_API_TOKEN: ${{ secrets.DL_SAR_API_TOKEN }}
run: |
SAR_VERSION=$(git describe --tags)
curl -X "POST" \
-H "Authorization: Bearer $DL_SAR_API_TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "version=$(echo $SAR_VERSION | awk -F- '{print $1}')" \
-F "sar_version=$SAR_VERSION" \
-F "system=windows" \
-F "commit=$GITHUB_SHA" \
-F "branch=$GITHUB_REF_NAME" \
-F "count=2" \
-F "hashes[0]=$(sha256sum bin/sar.dll | cut -d ' ' -f 1)" \
-F "hashes[1]=$(sha256sum bin/sar.pdb | cut -d ' ' -f 1)" \
-F "files[0]=@bin/sar.dll" \
-F "files[1]=@bin/sar.pdb" \
"https://dl.sar.portal2.sr/api/v1/upload"
release:
name: Release
if: github.repository == 'p2sr/SourceAutoRecord'
needs: [build-lin, build-win]
runs-on: ubuntu-latest
steps:
- name: Get Release Version
id: get_release
run: echo "{version}={${GITHUB_REF:10}}" >> $GITHUB_OUTPUT
- name: Download Linux Build
uses: actions/download-artifact@v4
with:
name: sar-linux
- name: Download Windows Build
uses: actions/download-artifact@v4
with:
name: sar-windows
- name: Download Windows PDB
uses: actions/download-artifact@v4
with:
name: sar-windows-pdb
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: |
![CD](https://github.com/p2sr/SourceAutoRecord/workflows/CD/badge.svg)
**Installation**
- Download:
- [Windows](https://github.com/p2sr/SourceAutoRecord/releases/download/${{ steps.get_release.outputs.version }}/sar.dll)
- [Linux](https://github.com/p2sr/SourceAutoRecord/releases/download/${{ steps.get_release.outputs.version }}/sar.so)
- Place the binary into the game folder e.g. `Portal 2`
- Open developer console and enter `plugin_load sar`
---
**Changelog**
TODO
files: |
sar.so
sar.dll
sar.pdb
prerelease: ${{ contains(github.ref, '-pre') }}
fail_on_unmatched_files: true