forked from valinet/ExplorerPatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (218 loc) · 9.06 KB
/
build-release.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# 2024-07-01 08:00
# build on windows-2022, [email protected]
# references:
# https://trstringer.com/github-actions-multiline-strings/
# https://trstringer.com/github-actions-create-release-upload-artifacts/
# https://github.com/Speedy37/sws/blob/444c67157a98652c4e7ffd3b6d6bbfb664071926/.github/workflows/msbuild.yml
# https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
name: Build-release
on:
# push:
# branches:
# - '**'
# tags-ignore:
# - '**'
# pull_request:
# branches:
# - '**'
# tags-ignore:
# - '**'
workflow_dispatch:
inputs:
ref:
description: 'Commit'
required: false
config:
description: 'Configuration'
required: false
build_dir:
description: 'Build dir'
required: false
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: windows-2022
steps:
- name: Print inputs
shell: bash
run: |
echo "ref: ${{ github.event.inputs.ref }}"
echo "config: ${{ github.event.inputs.config }}"
echo "build_dir: ${{ github.event.inputs.build_dir }}"
- name: Checkout latest build and submodules
uses: deep-soft/checkout@v4
if: github.event.inputs.ref == ''
with:
submodules: recursive
- name: Checkout specific build and submodules
uses: deep-soft/checkout@v4
if: github.event.inputs.ref != ''
with:
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- name: Add MSBuild to PATH
uses: deep-soft/setup-msbuild@v2
- name: Declare some variables
id: vars
shell: bash
run: |
#echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
#echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_OUTPUT"
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Enable SimpleWindowSwitcher support for newer Windows SDKs
shell: cmd
run: |
cd libs/sws
C:\msys64\usr\bin\wget.exe https://github.com/valinet/sws/commit/972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\dos2unix.exe 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\dos2unix.exe SimpleWindowSwitcher/sws_def.h
C:\msys64\usr\bin\patch.exe -N SimpleWindowSwitcher/sws_def.h 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\unix2dos.exe SimpleWindowSwitcher/sws_def.h
exit /b 0
- name: Setup NuGet
uses: deep-soft/setup-nuget@v2
- name: Restore NuGet packages
run: |
nuget restore ExplorerPatcher.sln
- name: Build funchook
shell: powershell
run: |
cd libs/funchook
md build
cd build
cmake -G "Visual Studio 17 2022" -A x64 ..
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
cmake --build . --config Release
- name: Build EP IA-32
if: github.event.inputs.config == ''
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}}
- name: Build EP amd64
if: github.event.inputs.config == ''
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}
- name: Build EP custom
if: github.event.inputs.config != ''
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{ github.event.inputs.config }} ${{env.SOLUTION_FILE_PATH}}
- name: Sign ExplorerPatcher files (0)
continue-on-error: true
uses: deep-soft/code-sign-action@v9
with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}'
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: './'
recursive: true
- name: Create expected build directory
if: github.event.inputs.build_dir != ''
shell: bash
run: |
mkdir build
cp -r ${{ github.event.inputs.build_dir }}/Release build/Release
- name: Generate dxgi.dll
shell: bash
working-directory: build/Release
run: |
if [[ -f "ExplorerPatcher.amd64.dll" ]]; then cp ExplorerPatcher.amd64.dll dxgi.dll; fi
- name: Sign ExplorerPatcher files (1)
continue-on-error: true
uses: deep-soft/code-sign-action@v9
with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}'
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: 'build/Release/'
recursive: true
- name: Patch setup
shell: cmd
working-directory: build/Release
run: |
ep_setup_patch.exe
exit /b 0
- name: Sign ExplorerPatcher files (2)
continue-on-error: true
uses: deep-soft/code-sign-action@v9
with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}'
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: 'build/Release/'
recursive: true
- name: Upload artifacts
uses: deep-soft/upload-artifact@v4
with:
name: ep_bin_multi_${{ steps.vars.outputs.sha_short }}_${{ steps.vars.outputs.branch }}
path: |
build/Release/
- name: Generate release name
shell: bash
working-directory: build/Release
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
run: |
# echo "::set-output name=data::$(./ep_generate_release_name.exe)"
echo "data=$(./ep_generate_release_name.exe)" >> "$GITHUB_OUTPUT"
id: release_name
- name: Generate release notes
shell: bash
working-directory: build/Release
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
run: |
MY_STRING=$(./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
MY_STRING="${MY_STRING//'%'/'%25'}"
#MY_STRING="${MY_STRING//$'\n'/'%0A'}"
#MY_STRING="${MY_STRING//$'\r'/'%0D'}"
MY_STRING="${MY_STRING//$'\n'/' \ '}"
MY_STRING="${MY_STRING//$'\r'/' \ '}"
#echo "::set-output name=data::$MY_STRING"
echo "data=$MY_STRING" >> "$GITHUB_OUTPUT"
./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} > ep_setup.txt
id: release_description
- name: Create/update release (valinet)
# uses: actions/create-release@v1
uses: deep-soft/[email protected]
if: github.repository_owner == 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
id: create_release
with:
draft: false
prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }}
release_name: ${{ steps.release_name.outputs.data }}
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
body: ${{ steps.release_description.outputs.data }}
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Upload setup (valinet)
# uses: actions/upload-release-asset@v1
uses: deep-soft/[email protected]
if: github.repository_owner == 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/Release/ep_setup.exe
asset_name: ep_setup.exe
asset_content_type: application/x-msdownload
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Create/update release (forks)
# uses: deep-soft/create-release@v2
uses: deep-soft/[email protected]
if: github.repository_owner != 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
id: create_release_fork
with:
draft: false
prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }}
name: ${{ steps.release_name.outputs.data }}
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
# body: ${{ steps.release_description.outputs.data }}
body_path: build/Release/ep_setup.txt
files: |
./build/Release/ep_setup.exe
./build/Release/ep_setup.txt