Skip to content

Commit

Permalink
merge 0.10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eriforce committed Aug 31, 2024
2 parents a54eb2e + 91a366b commit 8770664
Show file tree
Hide file tree
Showing 43 changed files with 1,561 additions and 203 deletions.
27 changes: 27 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,33 @@
"contributions": [
"translation"
]
},
{
"login": "Rastadu23",
"name": "Rastadu23",
"avatar_url": "https://avatars.githubusercontent.com/u/52637051?v=4",
"profile": "https://github.com/Rastadu23",
"contributions": [
"translation"
]
},
{
"login": "hauuau",
"name": "hauuau",
"avatar_url": "https://avatars.githubusercontent.com/u/52239673?v=4",
"profile": "https://github.com/hauuau",
"contributions": [
"code"
]
},
{
"login": "nellydocs",
"name": "nellydocs",
"avatar_url": "https://avatars.githubusercontent.com/u/71311423?v=4",
"profile": "https://github.com/nellydocs",
"contributions": [
"translation"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Setup Conan
run: pip install conan

- name: Load Conan cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.conan2/p
key: ${{ runner.os }}-conan-${{ hashFiles('src/**/conanfile.txt') }}
Expand All @@ -34,7 +34,7 @@ jobs:
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT

- name: Store build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Magpie-dev-${{ steps.hash.outputs.sha_short }}
path: ./publish
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,26 @@ on:
description: 'Tag'
required: false
type: string
prerelease:
description: 'Prerelease'
required: true
type: boolean
jobs:
release:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Setup Conan
run: pip install conan

- name: Load Conan cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.conan2/p
key: ${{ runner.os }}-conan-${{ hashFiles('src/**/conanfile.txt') }}
Expand All @@ -46,4 +50,5 @@ jobs:
MINOR: ${{ inputs.minor }}
PATCH: ${{ inputs.patch }}
TAG: ${{ inputs.tag }}
PRERELEASE: ${{ inputs.prerelease }}
ACCESS_TOKEN: ${{ secrets.CONTENTS_ACCESS_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand Down
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<WarningLevel>Level4</WarningLevel>
<!-- 'type' : class 'type1' needs to have dll-interface to be used by clients of class 'type2' -->
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<!-- /await:strict: 禁用协程的非标准语言扩展 -->
<!-- /utf-8: 源代码使用 UTF-8 格式 -->
<!-- /Zc:__cplusplus: 更新 __cplusplus 宏 -->
<!-- /volatile:iso: 禁用 volatile 的语义扩展 -->
<!-- /fp:contract: 生成浮点收缩指令。浮点收缩指令是将两个浮点操作合并为一个指令的机器指令,例如 Fused-Multiply-Add (FMA) -->
<!-- fp:contract 可以和其他 fp 选项同时存在,因此每个项目可以分别指定自己的浮点模型 -->
<!-- /await:strict: 禁用协程的非标准语言扩展 -->
<!-- /utf-8: 源代码使用 UTF-8 格式 -->
<!-- /Zc:__cplusplus: 更新 __cplusplus 宏 -->
<!-- /volatile:iso: 禁用 volatile 的语义扩展 -->
<!-- /fp:contract: 生成浮点收缩指令。浮点收缩指令是将两个浮点操作合并为一个指令的机器指令,例如 Fused-Multiply-Add (FMA) -->
<!-- fp:contract 可以和其他 fp 选项同时存在,因此每个项目可以分别指定自己的浮点模型 -->
<AdditionalOptions>%(AdditionalOptions) /await:strict /utf-8 /Zc:__cplusplus /volatile:iso /fp:contract</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
Expand Down
6 changes: 3 additions & 3 deletions Magpie.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{00AB63C3-0CD3-4944-B8E6-58C86138618D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
src\Common.Pre.props = src\Common.Pre.props
src\Common.Post.props = src\Common.Post.props
src\Common.Pre.props = src\Common.Pre.props
Directory.Build.props = Directory.Build.props
src\extract_winui_runtime.py = src\extract_winui_runtime.py
src\fix_resfiles.py = src\fix_resfiles.py
HybridCRT.props = HybridCRT.props
src\HybridCRT.props = src\HybridCRT.props
src\WinUI.props = src\WinUI.props
EndProjectSection
EndProject
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Thanks go to these wonderful people:
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Blinue"><img src="https://avatars.githubusercontent.com/u/34770031?v=4?s=100" width="100px;" alt="刘旭"/><br /><sub><b>Xu</b></sub></a><br /><a href="#maintenance-Blinue" title="Maintenance">🚧</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Code">💻</a> <a href="https://github.com/Blinue/Magpie/pulls?q=is%3Apr+reviewed-by%3ABlinue" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Documentation">📖</a> <a href="#question-Blinue" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Blinue"><img src="https://avatars.githubusercontent.com/u/34770031?v=4?s=100" width="100px;" alt="Xu"/><br /><sub><b>Xu</b></sub></a><br /><a href="#maintenance-Blinue" title="Maintenance">🚧</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Code">💻</a> <a href="https://github.com/Blinue/Magpie/pulls?q=is%3Apr+reviewed-by%3ABlinue" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Documentation">📖</a> <a href="#question-Blinue" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hooke007"><img src="https://avatars.githubusercontent.com/u/41094733?v=4?s=100" width="100px;" alt="hooke007"/><br /><sub><b>hooke007</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=hooke007" title="Documentation">📖</a> <a href="#question-hooke007" title="Answering Questions">💬</a> <a href="#userTesting-hooke007" title="User Testing">📓</a> <a href="https://github.com/Blinue/Magpie/commits?author=hooke007" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://palxex.ys168.com"><img src="https://avatars.githubusercontent.com/u/58222?v=4?s=100" width="100px;" alt="Pal Lockheart"/><br /><sub><b>Pal Lockheart</b></sub></a><br /><a href="#userTesting-palxex" title="User Testing">📓</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.stevedonaghy.com/"><img src="https://avatars.githubusercontent.com/u/1029699?v=4?s=100" width="100px;" alt="Steve Donaghy"/><br /><sub><b>Steve Donaghy</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=neoKushan" title="Code">💻</a> <a href="#translation-neoKushan" title="Translation">🌍</a></td>
Expand Down Expand Up @@ -113,6 +113,9 @@ Thanks go to these wonderful people:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fil08"><img src="https://avatars.githubusercontent.com/u/125665523?v=4?s=100" width="100px;" alt="fil08"/><br /><sub><b>fil08</b></sub></a><br /><a href="#translation-fil08" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/IsaiasYang"><img src="https://avatars.githubusercontent.com/u/20205571?v=4?s=100" width="100px;" alt="攸羚"/><br /><sub><b>攸羚</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=IsaiasYang" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ohaiibuzzle.dev"><img src="https://avatars.githubusercontent.com/u/23693150?v=4?s=100" width="100px;" alt="OHaiiBuzzle"/><br /><sub><b>OHaiiBuzzle</b></sub></a><br /><a href="#translation-ohaiibuzzle" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Rastadu23"><img src="https://avatars.githubusercontent.com/u/52637051?v=4?s=100" width="100px;" alt="Rastadu23"/><br /><sub><b>Rastadu23</b></sub></a><br /><a href="#translation-Rastadu23" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hauuau"><img src="https://avatars.githubusercontent.com/u/52239673?v=4?s=100" width="100px;" alt="hauuau"/><br /><sub><b>hauuau</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=hauuau" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nellydocs"><img src="https://avatars.githubusercontent.com/u/71311423?v=4?s=100" width="100px;" alt="nellydocs"/><br /><sub><b>nellydocs</b></sub></a><br /><a href="#translation-nellydocs" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 4 additions & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Magpie 是一个轻量级的窗口缩放工具,内置了多种高效的缩放
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Blinue"><img src="https://avatars.githubusercontent.com/u/34770031?v=4?s=100" width="100px;" alt="刘旭"/><br /><sub><b>Xu</b></sub></a><br /><a href="#maintenance-Blinue" title="Maintenance">🚧</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Code">💻</a> <a href="https://github.com/Blinue/Magpie/pulls?q=is%3Apr+reviewed-by%3ABlinue" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Documentation">📖</a> <a href="#question-Blinue" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Blinue"><img src="https://avatars.githubusercontent.com/u/34770031?v=4?s=100" width="100px;" alt="Xu"/><br /><sub><b>Xu</b></sub></a><br /><a href="#maintenance-Blinue" title="Maintenance">🚧</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Code">💻</a> <a href="https://github.com/Blinue/Magpie/pulls?q=is%3Apr+reviewed-by%3ABlinue" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/Blinue/Magpie/commits?author=Blinue" title="Documentation">📖</a> <a href="#question-Blinue" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hooke007"><img src="https://avatars.githubusercontent.com/u/41094733?v=4?s=100" width="100px;" alt="hooke007"/><br /><sub><b>hooke007</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=hooke007" title="Documentation">📖</a> <a href="#question-hooke007" title="Answering Questions">💬</a> <a href="#userTesting-hooke007" title="User Testing">📓</a> <a href="https://github.com/Blinue/Magpie/commits?author=hooke007" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://palxex.ys168.com"><img src="https://avatars.githubusercontent.com/u/58222?v=4?s=100" width="100px;" alt="Pal Lockheart"/><br /><sub><b>Pal Lockheart</b></sub></a><br /><a href="#userTesting-palxex" title="User Testing">📓</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.stevedonaghy.com/"><img src="https://avatars.githubusercontent.com/u/1029699?v=4?s=100" width="100px;" alt="Steve Donaghy"/><br /><sub><b>Steve Donaghy</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=neoKushan" title="Code">💻</a> <a href="#translation-neoKushan" title="Translation">🌍</a></td>
Expand Down Expand Up @@ -112,6 +112,9 @@ Magpie 是一个轻量级的窗口缩放工具,内置了多种高效的缩放
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fil08"><img src="https://avatars.githubusercontent.com/u/125665523?v=4?s=100" width="100px;" alt="fil08"/><br /><sub><b>fil08</b></sub></a><br /><a href="#translation-fil08" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/IsaiasYang"><img src="https://avatars.githubusercontent.com/u/20205571?v=4?s=100" width="100px;" alt="攸羚"/><br /><sub><b>攸羚</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=IsaiasYang" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ohaiibuzzle.dev"><img src="https://avatars.githubusercontent.com/u/23693150?v=4?s=100" width="100px;" alt="OHaiiBuzzle"/><br /><sub><b>OHaiiBuzzle</b></sub></a><br /><a href="#translation-ohaiibuzzle" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Rastadu23"><img src="https://avatars.githubusercontent.com/u/52637051?v=4?s=100" width="100px;" alt="Rastadu23"/><br /><sub><b>Rastadu23</b></sub></a><br /><a href="#translation-Rastadu23" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hauuau"><img src="https://avatars.githubusercontent.com/u/52239673?v=4?s=100" width="100px;" alt="hauuau"/><br /><sub><b>hauuau</b></sub></a><br /><a href="https://github.com/Blinue/Magpie/commits?author=hauuau" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nellydocs"><img src="https://avatars.githubusercontent.com/u/71311423?v=4?s=100" width="100px;" alt="nellydocs"/><br /><sub><b>nellydocs</b></sub></a><br /><a href="#translation-nellydocs" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>
Expand Down
79 changes: 55 additions & 24 deletions publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
if tag == "":
tag = f"v{majorVersion}.{minorVersion}.{patchVersion}"

isPrerelease = os.environ["PRERELEASE"].lower() == "true"

githubAccessToken = os.environ["ACCESS_TOKEN"]
repo = os.environ["GITHUB_REPOSITORY"]
actor = os.environ["GITHUB_ACTOR"]
Expand Down Expand Up @@ -133,7 +135,7 @@ def remove_file(file):

for folder in ["Microsoft.UI.Xaml", "Magpie.App"]:
shutil.rmtree(folder, ignore_errors=True)

for pattern in ["*.pdb", "*.lib", "*.exp", "*.winmd", "*.xml", "*.xbf", "dummy.*"]:
for file in glob.glob(pattern):
remove_file(file)
Expand Down Expand Up @@ -184,6 +186,7 @@ def remove_file(file):
break

xmlTree.write("resources.pri.xml", encoding="utf-8")
xmlTree = None

with open("priconfig.xml", "w", encoding="utf-8") as f:
print(
Expand Down Expand Up @@ -253,18 +256,50 @@ def remove_file(file):
shutil.make_archive(pkgName, "zip", "publish")
pkgName += ".zip"

# 发布 release
headers = {
"Accept": "application/vnd.github+json",
"Authorization": "Bearer " + githubAccessToken,
"X-GitHub-Api-Version": "2022-11-28",
}

# 获取前一个发布版本来生成默认发行说明
prevReleaseTag = None
try:
if isPrerelease:
# 发布预发行版与最新的版本(无论是正式版还是预发行版)对比
response = requests.get(
f"https://api.github.com/repos/{repo}/releases",
json={
"per_page": 1
},
headers=headers
)
if response.ok:
prevReleaseTag = response.json()[0]["tag_name"]
else:
# 发布正式版则与最新的正式版对比
# 由于可以自己选择最新版本,此接口可能不会返回时间上最新发布的版本,不是大问题
response = requests.get(f"https://api.github.com/repos/{repo}/releases/latest", headers=headers)
if response.ok:
prevReleaseTag = response.json()["tag_name"]
except:
# 忽略错误
pass

# 发布 release
if prevReleaseTag == None:
body = ""
else:
# 默认发行说明为比较两个 tag
body = f"https://github.com/{repo}/compare/{prevReleaseTag}...{tag}"

response = requests.post(
f"https://api.github.com/repos/{repo}/releases",
json={
"tag_name": tag,
"name": tag,
"generate_release_notes": True,
"prerelease": isPrerelease,
"body": body,
"discussion_category_name": "Announcements",
},
headers=headers,
Expand All @@ -276,34 +311,30 @@ def remove_file(file):
upload_url = upload_url[: upload_url.find("{")] + "?name=" + pkgName

# 上传资产
response = requests.post(
upload_url,
files={pkgName: open(pkgName, "rb")},
headers=headers,
)
if not response.ok:
raise Exception("上传失败")
with open(pkgName, "rb") as f:
# 流式上传
# https://requests.readthedocs.io/en/latest/user/advanced/#streaming-uploads
response = requests.post(
upload_url,
data=f,
headers={**headers, "Content-Type": "application/zip"},
)

print("已发布 " + tag, flush=True)
if not response.ok:
raise Exception("上传失败")

# 更新 version.json
# 此步应在发布版本之后,因为程序使用 version.json 检查更新
# 计算哈希
f.seek(0, os.SEEK_SET)
md5 = hashlib.file_digest(f, hashlib.md5).hexdigest()

# 资产上传后会被 Github 修改,我们应计算修改后的哈希值
response = requests.get(
response.json()["browser_download_url"],
)
if not response.ok:
raise Exception("下载失败")

hasher = hashlib.md5()
for chunk in response.iter_content(chunk_size=8192):
hasher.update(chunk)
print("已发布 " + tag, flush=True)

# 丢弃当前修改并更新到最新,防止编译时有新的提交
subprocess.run("git checkout -f")
subprocess.run("git pull")

# 更新 version.json
# 此步应在发布版本之后,因为程序使用 version.json 检查更新
with open("version.json", "w", encoding="utf-8") as f:
json.dump(
{
Expand All @@ -312,7 +343,7 @@ def remove_file(file):
"binary": {
"x64": {
"url": f"https://github.com/{repo}/releases/download/{tag}/{pkgName}",
"hash": hasher.hexdigest(),
"hash": md5,
}
},
},
Expand Down
5 changes: 1 addition & 4 deletions src/Common.Post.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<!-- WINRT_NO_SOURCE_LOCATION: VS 2022 17.6 开始 <source_location> 返回完全限定函数名,使 cppwinrt 中大量的模板函数无法 COMDAT 折叠, -->
<!-- 从而大幅增加了二进制文件的体积。定义 WINRT_NO_SOURCE_LOCATION 以禁止 cppwinrt 使用 <source_location>。这是一个临时解决方案,在未来 -->
<!-- 我们应定义 _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION=0 恢复 <source_location> 的旧行为,因为它也让日志文件多了很多废话。 -->
<PreprocessorDefinitions>NDEBUG;WINRT_NO_SOURCE_LOCATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
Expand Down
Loading

0 comments on commit 8770664

Please sign in to comment.