-
Notifications
You must be signed in to change notification settings - Fork 12
61 lines (53 loc) · 1.79 KB
/
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
name: Release Workflow
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.get-timestamp.outputs.time }}
steps:
- name: Get build timestamp
id: get-timestamp
run: |
echo "time=$(TZ="Asia/Shanghai" /bin/date "+%Y-%m-%d-%H%M")" >> $GITHUB_OUTPUT
- name: Generate environmental variables
id: generate_env_vars
run: |
echo "tag_name=nlcisbn-${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
echo "release_name=NLCISBN Plugin Release ${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
# 创建ZIP压缩包
- name: Create ZIP Archive
run: |
zip NLCISBNPlugin.zip *.py README.md LICENSE
# 创建发布说明
- name: Generate Release Notes
id: generate_notes
run: |
RELEASE_NOTES=$(git log --format='%h %s' --reverse $(git describe --tags --abbrev=0 @^)..@)
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_ENV
# 创建发布
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.generate_env_vars.outputs.tag_name }}
release_name: ${{ steps.generate_env_vars.outputs.release_name }}
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: true
# 上传ZIP文件作为发布资产
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./NLCISBNPlugin.zip
asset_name: NLCISBNPlugin.zip
asset_content_type: application/zip