Skip to content

Commit 6641796

Browse files
committed
初始 1.0.0
0 parents  commit 6641796

30 files changed

+2324
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build and Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "master" ]
7+
tags: [ "v*" ]
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '8.0.x'
24+
25+
- name: Restore dependencies
26+
run: dotnet restore PCL_CE_Patcher.csproj
27+
28+
# =========================================================
29+
# 步骤 1:根据触发类型设置变量 (控制 PDB)
30+
# =========================================================
31+
- name: Set Build Options
32+
id: options
33+
shell: pwsh
34+
run: |
35+
if ("${{ github.ref }}".StartsWith("refs/tags/")) {
36+
echo "IS_RELEASE=true" >> $env:GITHUB_ENV
37+
# Release: 无调试符号,极致瘦身
38+
echo "BUILD_ARGS=-p:DebugType=None -p:DebugSymbols=false" >> $env:GITHUB_ENV
39+
} else {
40+
echo "IS_RELEASE=false" >> $env:GITHUB_ENV
41+
# CI: 保留调试符号,方便查错
42+
echo "BUILD_ARGS=-p:DebugType=portable -p:DebugSymbols=true" >> $env:GITHUB_ENV
43+
}
44+
45+
# =========================================================
46+
# 步骤 2:编译 (全靠参数控制)
47+
# =========================================================
48+
- name: Publish Patcher
49+
run: |
50+
dotnet publish PCL_CE_Patcher.csproj -c Release -r win-x64 `
51+
--no-self-contained `
52+
-p:PublishSingleFile=true `
53+
-p:IncludeNativeLibrariesForSelfExtract=true `
54+
${{ env.BUILD_ARGS }} `
55+
-o ./output
56+
57+
# =========================================================
58+
# 步骤 3:准备文件
59+
# =========================================================
60+
- name: Prepare Assets
61+
run: |
62+
copy LICENSE ./output/
63+
copy ThirdPartyNotices.txt ./output/
64+
65+
# =========================================================
66+
# 步骤 4:打包与上传
67+
# =========================================================
68+
69+
# 场景 A: 正式发布 (Tag) -> 手动打 Zip
70+
- name: Zip for Release
71+
if: env.IS_RELEASE == 'true'
72+
run: |
73+
powershell Compress-Archive -Path ./output/* -DestinationPath PCL_CE_Patcher.zip
74+
75+
# 场景 B: CI 测试 (Push) -> 上传文件夹 (Action会自动压成zip)
76+
- name: Upload CI Artifact
77+
if: env.IS_RELEASE == 'false'
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: PCL_CE_Patcher_CI_Build
81+
path: ./output/*
82+
retention-days: 7
83+
84+
# 场景 A: 正式发布 -> 上传 Release 附件备用
85+
- name: Upload Release Artifact
86+
if: env.IS_RELEASE == 'true'
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: PCL_CE_Patcher_Release_Pkg
90+
path: PCL_CE_Patcher.zip
91+
retention-days: 90
92+
93+
# =========================================================
94+
# 步骤 5:发布到 GitHub Releases (仅 Tag)
95+
# =========================================================
96+
- name: Upload to Release Page
97+
uses: softprops/action-gh-release@v1
98+
if: startsWith(github.ref, 'refs/tags/')
99+
with:
100+
files: PCL_CE_Patcher.zip

0 commit comments

Comments
 (0)