-
Notifications
You must be signed in to change notification settings - Fork 6
69 lines (61 loc) · 2.76 KB
/
publish.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
# adapted from https://patriksvensson.se/2020/03/creating-release-artifacts-with-github-actions/
name: Publish
on:
release:
types: [published]
jobs:
release:
name: Release
strategy:
matrix:
kind: ['windowsx64', 'windowsx86', 'windowsarm64']
include:
- kind: windowsx64
os: windows-2022
target: win-x64
- kind: windowsx86
os: windows-2022
target: win-x86
- kind: windowsarm64
os: windows-2022
target: win-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE64_PFX: ${{ secrets.BASE64_PFX }}
PFX_PASSWORD: ${{ secrets.PFX_PASSWORD }}
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="JL-$tag-${{ matrix.target }}"
# Build everything
dotnet publish JL.Windows/JL.Windows.csproj --framework net8.0-windows --runtime "${{ matrix.target }}" --no-self-contained -c Release -o "$release_name" //p:Version=$tag
# Mark JL as LARGEADDRESSAWARE
if [ "${{ matrix.target }}" = "win-x86" ]
then
vswhere_path="C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe"
read -r vc_tools_version<"$("$vswhere_path" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find "VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt")"
vc_tools_version="${vc_tools_version//$'\r'/}"
editbin_path=$("${vswhere_path}" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find "VC/Tools/MSVC/${vc_tools_version}/bin/Hostx64/x64/editbin.exe")
"${editbin_path}" //NOLOGO //LARGEADDRESSAWARE ${release_name}/JL.exe
fi
#Sign with self-signed certificate
pfxCertFilePath=${release_name}/JLCertificate.pfx
echo "${BASE64_PFX}" | base64 --decode > "${pfxCertFilePath}"
pwsh -c '$password = ConvertTo-SecureString -String '"${PFX_PASSWORD}"' -Force -AsPlainText;''$pfx = Get-PfxCertificate -FilePath '"$pfxCertFilePath"' -Password $password -NoPromptForPassword;''Set-AuthenticodeSignature -FilePath '"$release_name"'/JL.exe -Certificate $pfx -HashAlgorithm SHA256;'
rm "${pfxCertFilePath}"
# Pack files
7z a -tzip "${release_name}.zip" "./${release_name}/*"
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v2
with:
files: "JL*.zip"