Skip to content

Commit 863de43

Browse files
committed
添加Release工作流以支持自动化发布过程
1 parent a604eb0 commit 863de43

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Build
22

33
on:
44
workflow_dispatch:
5-
5+
push:
6+
pull_request:
7+
workflow_call:
68
jobs:
79
run:
810
name: build

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
8+
Compile:
9+
name: Compile
10+
uses: ./.github/workflows/build.yml
11+
12+
Release:
13+
name: Release
14+
needs: Compile
15+
runs-on: windows-latest
16+
env:
17+
Artifacts_Path: .artifacts
18+
19+
steps:
20+
21+
- name: Download Artifacts
22+
uses: actions/download-artifact@v4
23+
with:
24+
merge-multiple: true
25+
path: ${{ env.Artifacts_Path }}
26+
27+
- name: Generate Tag
28+
run: |
29+
$releases = (gh release list --repo Xcube-Studio/FluentLauncher.Preview.Installer --limit 100 | Measure-Object -Line).Lines
30+
31+
$major=1
32+
$minor=0
33+
$patch=0
34+
35+
$patch += $releases % 12
36+
$minor += [math]::Floor($releases / 12)
37+
$major += [math]::Floor($minor / 6)
38+
$minor %= 6
39+
40+
$version="$major.$minor.$patch"
41+
echo "Generated version: $version"
42+
echo "version=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
43+
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
47+
- name: Create Release
48+
uses: ncipollo/[email protected]
49+
with:
50+
artifacts: "${{ env.Artifacts_Path }}\\*.*"
51+
allowUpdates: true
52+
generateReleaseNotes: true
53+
tag: "v${{ env.version }}"
54+
55+
- name: Upload Files To Oss
56+
uses: xcube-studio/sync2oss@v2
57+
with:
58+
repoUrl: "Xcube-Studio/FluentLauncher.Preview.Installer"
59+
accessKeyId: ${{ secrets.ALIYUN_ACCESSKEYID }}
60+
accessKeySecret: ${{secrets.ALIYUN_ACCESSKEYSECRET}}
61+
endpoint: ${{secrets.ALIYUN_OSS_ENDPOINT}}
62+
bucketName: ${{secrets.ALIYUN_OSS_BUCKETNAME_1}}
63+
region: "cn-shanghai"
64+
addSymlink: True
65+
fromRelease: True
66+
remoteDir: "FluentLauncher.Preview.Installer"

0 commit comments

Comments
 (0)