-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (89 loc) · 2.71 KB
/
build-release.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: 发布应用
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: write
actions: write
jobs:
jobs_version:
name: 构建版本号和变更信息
runs-on: ubuntu-latest
outputs:
version: ${{ steps.create_version.outputs.tag_name }}
body: ${{ steps.create_version.outputs.body }}
steps:
- uses: release-drafter/release-drafter@v6
id: create_version
with:
config-name: release-drafter.yml
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 查看变量
run: |
echo "version=${{ steps.create_version.outputs.tag_name }}"
jobs_windows:
needs: jobs_version
name: 构建EXE
runs-on: windows-2022
env:
version: ${{ needs.jobs_version.outputs.version }}
body: ${{ needs.jobs_version.outputs.body }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: 读入环境信息
run: |
echo "version=${{ env.version }}"
- name: 编译环境设置
uses: actions/setup-python@v5
with:
python-version: "3.11.2"
architecture: "x64"
cache: 'pip'
- name: 下载依赖文件
run: pip install -r requirements.txt
- name: 编译exe
run: |
python -m pip install --upgrade pip
pyinstaller main-win.spec
- name: 查看dist目录
run: |
ls ./dist # 列出生成文件,确保文件存在
- name: 上传应用
uses: actions/upload-artifact@v4
with:
name: windows-artifact
path: ./dist/*.exe # 确保上传的路径正确
jobs4:
needs: [ jobs_version, jobs_windows ]
name: 发布版本
runs-on: ubuntu-latest
env:
version: ${{ needs.jobs_version.outputs.version }}
body: ${{ needs.jobs_version.outputs.body }}
steps:
- name: 下载
id: download
uses: actions/download-artifact@v4
with:
name: windows-artifact
path: ./ # 确保下载到根目录
- name: 读入环境信息
run: |
echo "version=${{ env.version }}"
echo "download path: ${{ steps.download.outputs.download-path }}"
ls -R # 列出所有文件,确认下载成功
- name: 发布文件
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
#prerelease: true # 预发布 别人可以看到 版本号会继续加
tag: ${{ env.version }}
body: ${{ env.body }}
artifacts: "./*.exe" # 确保路径指向下载的文件