Skip to content

Commit

Permalink
累积策略更新并调整发布策略 (#23)
Browse files Browse the repository at this point in the history
修复 Github Action执行报错的问题
调整 重新使用单文件模式发布
更新 策略配置文件至128.0.2708.0版本
更新 依赖性
  • Loading branch information
NXY666 authored Jul 21, 2024
1 parent ffc9ade commit e674598
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 115 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const {execSync} = require('child_process');
const github = require('@actions/github');
const {Octokit} = require('@octokit/rest');
import fs from 'fs';
import {execSync} from 'child_process';
import github from '@actions/github';
import {Octokit} from '@octokit/rest';

function notice(msg) {
console.log(`* ${msg}`);
Expand Down Expand Up @@ -36,41 +36,23 @@ function retry(fn, retryCount = 0) {
await Promise.all(['x64', 'x86', 'arm64'].map((arch) => {
execSync(`dotnet publish -p:Platform=${arch} -p:PublishProfile=Properties/PublishProfiles/win-${arch}.pubxml`);
notice(`${arch} 架构软件包生成完成。`);
execSync(`7z a -tzip Publish-${arch}.zip ./bin/publish/win-${arch}/*`);
execSync(`7z a -t7z Publish-${arch}.7z ./bin/publish/win-${arch}/*`);
notice(`${arch} 架构软件包压缩完成。`);
}));

const files = [
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x64.zip',
path: 'Publish-x64.zip',
contentType: 'application/zip'
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x64.exe',
path: './bin/publish/win-x64/EdgePolicyManager.exe',
contentType: 'application/octet-stream'
},
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x64.7z',
path: 'Publish-x64.7z',
contentType: 'application/7z'
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x86.exe',
path: './bin/publish/win-x86/EdgePolicyManager.exe',
contentType: 'application/octet-stream'
},
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x86.zip',
path: 'Publish-x86.zip',
contentType: 'application/zip'
},
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-x86.7z',
path: 'Publish-x86.7z',
contentType: 'application/7z'
},
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-arm64.zip',
path: 'Publish-arm64.zip',
contentType: 'application/zip'
},
{
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-arm64.7z',
path: 'Publish-arm64.7z',
contentType: 'application/7z'
name: 'EdgePolicyManager-v${PUBLISH_VERSION}-arm64.exe',
path: './bin/publish/win-arm64/EdgePolicyManager.exe',
contentType: 'application/octet-stream'
}
];

Expand Down Expand Up @@ -142,14 +124,18 @@ function retry(fn, retryCount = 0) {
assetsTable += `|${assetIcon} [${asset.name}](${asset.browser_download_url})|${fileSizeString(asset.size)}|\n`;
}

await retry(() => giteeO.repos.createRelease({
owner, repo,
tag_name: CONFIG === 'Debug' ? 'test' : `v${PUBLISH_VERSION}`,
target_commitish: CONFIG === 'Debug' ? 'test' : 'master',
name: CONFIG === 'Debug' ? `仅供测试 ${PUBLISH_VERSION}` : `发行版 ${PUBLISH_VERSION}`,
body: `## 更新日志\n\n概述:**${COMMIT_TITLE}**\n\n<details>\n\n${COMMIT_BODY}\n\n</details>\n\n<hr>\n\n> 发布时间:${PUBLISH_DATETIME}\n\n> 策略版本:${EDGE_POLICY_VERSION}\n\n${assetsTable}`,
prerelease: false
}));
if (CONFIG === 'Debug') {
await retry(() => giteeO.repos.getLatestRelease({owner, repo}));
} else {
await retry(() => giteeO.repos.createRelease({
owner, repo,
tag_name: `v${PUBLISH_VERSION}`,
target_commitish: 'master',
name: `发行版 ${PUBLISH_VERSION}`,
body: `## 更新日志\n\n概述:**${COMMIT_TITLE}**\n\n<details>\n\n${COMMIT_BODY}\n\n</details>\n\n<hr>\n\n> 发布时间:${PUBLISH_DATETIME}\n\n> 策略版本:${EDGE_POLICY_VERSION}\n\n${assetsTable}`,
prerelease: false
}));
}
}
notice('Gitee Release 发布完成。');
})();
})();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs');
const {XMLParser, XMLBuilder} = require('fast-xml-parser');
import fs from 'fs';
import {XMLParser, XMLBuilder} from 'fast-xml-parser';

(async () => {
const {PUBLISH_VERSION, CONFIG} = process.env;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: 修改版本号
run: |
npm i fast-xml-parser
node .github/workflows/edit_version.js
node .github/workflows/edit_version.mjs
- name: 克隆完整仓库
run: |
Expand Down Expand Up @@ -71,4 +71,4 @@ jobs:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
run: |
npm i @actions/github @octokit/rest
node .github/workflows/create_release.js
node .github/workflows/create_release.mjs
6 changes: 3 additions & 3 deletions .github/workflows/test_publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: 修改版本号
run: |
npm i fast-xml-parser
node .github/workflows/edit_version.js
node .github/workflows/edit_version.mjs
- name: 克隆完整仓库
run: |
Expand All @@ -56,7 +56,7 @@ jobs:
max_attempts: 3
command: |
git fetch --unshallow
git push -f "https://NXY666:$env:[email protected]/NXY666/EdgePolicyManager.git"
git ls-remote "https://NXY666:$env:[email protected]/NXY666/EdgePolicyManager.git"
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}

Expand All @@ -71,4 +71,4 @@ jobs:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
run: |
npm i @actions/github @octokit/rest
node .github/workflows/create_release.js
node .github/workflows/create_release.mjs
48 changes: 3 additions & 45 deletions PolicyManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" />
<PackageReference Include="Microsoft.NET.ILLink.Tasks" Version="8.0.7" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<Manifest Include="$(ApplicationManifest)" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="WinUIEx" Version="2.3.4" />
Expand Down Expand Up @@ -129,47 +130,4 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
</PropertyGroup>

<Target Name="RemovePublishFoldersWithMuiFiles" AfterTargets="GenerateNuspec;Publish">
<ItemGroup>
<!-- Create a list of the languages your need to keep.-->
<KeepingLanguages Include="en-US;en-GB;zh-CN;zh-TW" />
<!-- Create a list of keeping files. -->
<KeepingFiles Include="@(KeepingLanguages->'$(PublishDir)%(Identity)\*.mui')" />
<!-- Create a list of removing files. -->
<RemovingFiles Include="$(PublishDir)*\*.mui" Exclude="@(KeepingFiles)" />
<!-- Create a list of removing folders. -->
<RemovingFolders Include="@(RemovingFiles->'%(RootDir)%(Directory)')" />
</ItemGroup>
<!-- Execute RemoveDir command and remove all folders in "RemovingFolders".-->
<RemoveDir Directories="@(RemovingFolders)" />
</Target>
<Target Name="RemoveBuildFoldersWithMuiFiles" AfterTargets="Build">
<ItemGroup>
<!-- Create a list of the languages your need to keep.-->
<KeepingLanguages Include="en-US;en-GB;zh-CN;zh-TW" />
<!-- Create a list of keeping files. -->
<KeepingFiles Include="@(KeepingLanguages->'$(OutDir)%(Identity)\*.mui')" />
<!-- Create a list of removing files. -->
<RemovingFiles Include="$(OutDir)*\*.mui" Exclude="@(KeepingFiles)" />
<!-- Create a list of removing folders. -->
<RemovingFolders Include="@(RemovingFiles->'%(RootDir)%(Directory)')" />
</ItemGroup>
<!-- Execute RemoveDir command and remove all folders in "RemovingFolders".-->
<RemoveDir Directories="@(RemovingFolders)" />
</Target>
<Target Name="RemoveSinglePublishFoldersWithMuiFiles" BeforeTargets="GenerateSingleFileBundle" DependsOnTargets="PrepareForBundle">
<ItemGroup>
<!-- Create a list of the languages your need to keep.-->
<KeepingLanguages Include="en-US;en-GB;zh-CN;zh-TW" />
<!-- Create a list of keeping files. -->
<KeepingFiles Include="@(KeepingLanguages->'$(OutDir)%(Identity)\*.mui')" />
<!-- Create a list of removing files. -->
<RemovingFiles Include="$(OutDir)*\*.mui" Exclude="@(KeepingFiles)" />
<!-- Create a list of removing folders. -->
<RemovingFolders Include="@(RemovingFiles->'%(RootDir)%(Directory)')" />
</ItemGroup>
<!-- Execute RemoveDir command and remove all folders in "RemovingFolders".-->
<RemoveDir Directories="@(RemovingFolders)" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Properties/PublishProfiles/win-arm64.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishReadyToRun>false</PublishReadyToRun>
<!-- <PublishSingleFile>true</PublishSingleFile>-->
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Properties/PublishProfiles/win-x64.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishReadyToRun>false</PublishReadyToRun>
<!-- <PublishSingleFile>true</PublishSingleFile>-->
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Properties/PublishProfiles/win-x86.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishReadyToRun>false</PublishReadyToRun>
<!-- <PublishSingleFile>true</PublishSingleFile>-->
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/en-US/PolicyDetailMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/en-US/PolicyMenuList.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/zh-CN/PolicyDetailMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/zh-CN/PolicyMenuList.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/zh-TW/PolicyDetailMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/Edge/zh-TW/PolicyMenuList.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/EdgeUpdate/en-US/PolicyDetailMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion StaticModels/Policy/EdgeUpdate/en-US/PolicyMenuList.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"Identifier":"Preferences","Icon":"AllApps","Name":"Preferences","Items":["AutoUpdateCheckPeriodMinutes","UpdatesSuppressedStartHour"]},{"Identifier":"ProxyServer","Icon":"VPN","Name":"Proxy Server","Items":["ProxyMode","ProxyServer","ProxyPacUrl"]},{"Identifier":"Applications","Icon":"ProductivityMode","Name":"Applications","Items":["InstallDefault","UpdateDefault","Allowsxs","CreateDesktopShortcutDefault","MeteredUpdatesDefault","RemoveDesktopShortcutDefault"]},{"Identifier":"EdgeUpdate","Icon":"World","Name":"Microsoft Edge Update","Items":["UpdaterExperimentationAndConfigurationServiceControl"]},{"Identifier":"MicrosoftEdge","Icon":"World","Name":"Microsoft Edge","Items":["Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","Update{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","RemoveDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","TargetVersionPrefix{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","RollbackToTargetVersion{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","MeteredUpdates{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","TargetChannel{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","EdgePreview{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}"]},{"Identifier":"MicrosoftEdgeBeta","Icon":"World","Name":"Microsoft Edge Beta","Items":["Install{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","Update{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","RemoveDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","TargetVersionPrefix{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","RollbackToTargetVersion{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","MeteredUpdates{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}"]},{"Identifier":"MicrosoftEdgeDev","Icon":"World","Name":"Microsoft Edge Dev","Items":["Install{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","Update{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","RemoveDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","TargetVersionPrefix{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","RollbackToTargetVersion{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","MeteredUpdates{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}"]},{"Identifier":"MicrosoftEdgeCanary","Icon":"World","Name":"Microsoft Edge Canary","Items":["Install{65C35B14-6C1D-4122-AC46-7148CC9D6497}","Update{65C35B14-6C1D-4122-AC46-7148CC9D6497}","CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}","RemoveDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}","TargetVersionPrefix{65C35B14-6C1D-4122-AC46-7148CC9D6497}","RollbackToTargetVersion{65C35B14-6C1D-4122-AC46-7148CC9D6497}","MeteredUpdates{65C35B14-6C1D-4122-AC46-7148CC9D6497}"]},{"Identifier":"WebView","Icon":"World","Name":"Microsoft Edge WebView2 Runtime","Items":["Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}","Update{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"]}]
[{"Identifier":"Preferences","Icon":"AllApps","Name":"Preferences","Items":["AutoUpdateCheckPeriodMinutes","UpdatesSuppressedStartHour"]},{"Identifier":"ProxyServer","Icon":"VPN","Name":"Proxy Server","Items":["ProxyMode","ProxyServer","ProxyPacUrl"]},{"Identifier":"Applications","Icon":"ProductivityMode","Name":"Applications","Items":["InstallDefault","UpdateDefault","Allowsxs","CreateDesktopShortcutDefault","MeteredUpdatesDefault","RemoveDesktopShortcutDefault"]},{"Identifier":"EdgeUpdate","Icon":"World","Name":"Microsoft Edge Update","Items":["UpdaterExperimentationAndConfigurationServiceControl"]},{"Identifier":"MicrosoftEdge","Icon":"World","Name":"Microsoft Edge","Items":["Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","Update{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","RemoveDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","TargetVersionPrefix{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","RollbackToTargetVersion{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","MeteredUpdates{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","TargetChannel{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","EdgePreview{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}","Uninstall{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}"]},{"Identifier":"MicrosoftEdgeBeta","Icon":"World","Name":"Microsoft Edge Beta","Items":["Install{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","Update{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","RemoveDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","TargetVersionPrefix{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","RollbackToTargetVersion{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}","MeteredUpdates{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}"]},{"Identifier":"MicrosoftEdgeDev","Icon":"World","Name":"Microsoft Edge Dev","Items":["Install{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","Update{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","RemoveDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","TargetVersionPrefix{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","RollbackToTargetVersion{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}","MeteredUpdates{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}"]},{"Identifier":"MicrosoftEdgeCanary","Icon":"World","Name":"Microsoft Edge Canary","Items":["Install{65C35B14-6C1D-4122-AC46-7148CC9D6497}","Update{65C35B14-6C1D-4122-AC46-7148CC9D6497}","CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}","RemoveDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}","TargetVersionPrefix{65C35B14-6C1D-4122-AC46-7148CC9D6497}","RollbackToTargetVersion{65C35B14-6C1D-4122-AC46-7148CC9D6497}","MeteredUpdates{65C35B14-6C1D-4122-AC46-7148CC9D6497}"]},{"Identifier":"WebView","Icon":"World","Name":"Microsoft Edge WebView2 Runtime","Items":["Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}","Update{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"]}]
2 changes: 1 addition & 1 deletion StaticModels/Policy/EdgeUpdate/zh-CN/PolicyDetailMap.json

Large diffs are not rendered by default.

Loading

0 comments on commit e674598

Please sign in to comment.