-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (65 loc) · 2.14 KB
/
publisher.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: Test Publisher
on:
push:
branches:
- master
jobs:
publish:
runs-on: windows-latest
strategy:
matrix:
node-version: [ 20.x ]
dotnet-version: [ 8.0.x ]
env:
CONFIG: Release
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 获取发布信息
run: |
echo "PUBLISH_VERSION=$(Get-Date -Format 'yyyy.MM.dd.HHmm')" >> $env:GITHUB_ENV
echo "PUBLISH_DATETIME=$(Get-Date -Format 'yyyy.MM.dd HH:mm:ss')" >> $env:GITHUB_ENV
echo "EDGE_POLICY_VERSION=$(Get-Content ./StaticModels/Policy/SUPPORT_VERSION)" >> $env:GITHUB_ENV
- name: 获取提交信息
run: |
echo "COMMIT_TITLE=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
commit_body=$(git log -1 --pretty=format:"%b" | sed -E 's/^([^ ]+) (.+)$/* `\1` \2/')
{
echo 'COMMIT_BODY<<EOF'
echo "$commit_body"
echo EOF
} >> "$GITHUB_ENV"
shell: bash
- name: 修改版本号
run: |
node .github/workflows/edit_version.mjs
- name: 克隆完整仓库
run: |
git fetch --unshallow
- name: 优化 Gitee 连接
run: |
echo 182.255.33.134 gitee.com >> C:\Windows\System32\drivers\etc\hosts
ipconfig /flushdns
- name: 同步分支到 Gitee
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 3
command: |
git fetch --unshallow
git push -f "https://NXY666:$env:[email protected]/NXY666/EdgePolicyManager.git"
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
- name: 安装 .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
cache: true
- name: 发布软件包
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
run: |
npm i -g @actions/github @octokit/rest
npm link @actions/github @octokit/rest
node .github/workflows/create_release.mjs