-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.34 KB
/
Copy pathpackage.yml
File metadata and controls
52 lines (42 loc) · 1.34 KB
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
#标签触发命令:
#git tag v1.0.0
#git push origin v1.0.0
name: Package Python Tools
on:
push:
tags: ['v*']
workflow_dispatch:
jobs:
package:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create package
run: |
# 根据触发类型确定文件名
if [ "${{ github.event_name }}" = "push" ]; then
FILENAME="${{ github.event.repository.name }}-${{ github.ref_name }}.zip"
else
FILENAME="${{ github.event.repository.name }}-manual-$(date +%Y%m%d).zip"
fi
# 查找所有.py文件和UserGuide.txt
find . -name "*.py" -o -name "UserGuide.txt" | zip -@ $FILENAME
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
- name: Release or Artifact
run: |
echo "触发方式: ${{ github.event_name }}"
echo "包文件: $FILENAME"
- name: Create Release (标签触发)
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.FILENAME }}
- name: Upload Artifact (手动触发)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: python-tools-package
path: ${{ env.FILENAME }}
retention-days: 1