-
Notifications
You must be signed in to change notification settings - Fork 39
76 lines (65 loc) · 2.48 KB
/
build.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
name: build
on:
push:
branches:
- dev
paths:
- 'GalgameManager/**'
- 'GalgameManager.Core/**'
- 'GalgameManager.Server/**'
- 'GalgameManager.Test/**'
pull_request:
paths:
- 'GalgameManager/**'
- 'GalgameManager.Core/**'
- 'GalgameManager.Server/**'
- 'GalgameManager.Test/**'
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
platform: ["x86", "x64", "ARM64"]
steps:
- uses: actions/checkout@v4
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Update version
shell: pwsh
run: |
$manifestPath = "GalgameManager/Package.appxmanifest"
[xml]$manifest = Get-Content $manifestPath
$version = $manifest.Package.Identity.Version
$versionParts = $version.Split('.')
$versionParts[3] = [string]([int]$versionParts[3] + 1)
$versionParts[3] = $env:GITHUB_RUN_NUMBER
$newVersion = [string]::Join('.', $versionParts)
$manifest.Package.Identity.Version = $newVersion
$manifest.Save($manifestPath)
echo "Updated version to $newVersion"
- name: Update app icon
shell: pwsh
run: |
xcopy "GalgameManager\Assets\Pictures\icon-dev\*" "GalgameManager\Assets\" /s /e /y
echo "Updated app icon"
- name: Create the app package
run: msbuild GalgameManager\GalgameManager.csproj /restore "/p:Platform=${{ matrix.platform }};Configuration=Release;UapAppxPackageBuildMode=SideloadOnly;AppxPackageDir=..\publish\;GenerateAppxPackageOnBuild=true;AppxPackageSigningEnabled=true;PackageCertificateKeyFile=GalgameManager_TemporaryKey.pfx"
- name: Move package
shell: pwsh
run: |
# 将 msix 和 cer 移动到 publish 根目录
$subFolder = Get-ChildItem -Path publish -Directory | Select-Object -First 1
$msixFile = Get-ChildItem -Path $subFolder.FullName -Filter "*.msix" -File | Select-Object -First 1
$cerFile = Get-ChildItem -Path $subFolder.FullName -Filter "*.cer" -File | Select-Object -First 1
if ($msixFile -and $cerFile) { Move-Item $msixFile.FullName, $cerFile.FullName -Destination publish -Force }
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: PotatoVN-${{ matrix.platform }}-sideload
path: |
publish/*.msix
publish/*.cer