Skip to content

Commit 166cc51

Browse files
committedNov 2, 2024
💚 feat(release): 更新 GitHub Actions 工作流以支持参考音频文件的压缩和上传
1 parent d3590c2 commit 166cc51

4 files changed

+35
-13
lines changed
 

‎.github/workflows/github-release.yml

+35-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,52 @@
11
name: Release to GitHub
22
on:
33
push:
4-
tags:
5-
- 'v*' # 匹配"v1.0.0"、"v1.0.0-alpha"等发布标签
6-
4+
paths:
5+
- 'res/reference_audio/**' # Trigger on changes in the reference_audio folder
6+
77
permissions:
8-
contents: write # 如果您的包发布到 GitHub Packages,则需要此权限
9-
packages: write # 如果您的包发布到 GitHub Packages,则需要此权限
8+
contents: write
9+
packages: write
10+
1011
jobs:
1112
build:
1213
name: Create Release
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout code
1617
uses: actions/checkout@v2
18+
19+
- name: Get latest commit info
20+
id: get_commit_info
21+
run: |
22+
echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
23+
echo "COMMIT_URL=$(git log -1 --pretty=%H)" >> $GITHUB_OUTPUT
24+
echo "COMMIT_AUTHOR=$(git log -1 --pretty=%an)" >> $GITHUB_OUTPUT
25+
26+
- name: Compress reference_audio folder
27+
run: |
28+
zip -r reference_audio.zip res/reference_audio
29+
1730
- name: Create Release
1831
id: create_release
1932
uses: actions/create-release@v1
2033
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2235
with:
23-
tag_name: ${{ github.ref }}
24-
release_name: Release ${{ github.ref }}
25-
# 修改发布说明为最新提交的提交信息
36+
tag_name: ${{ github.sha }}
37+
release_name: Release ${{ github.sha }}
2638
body: |
27-
最新提交: ${{ github.event.head_commit.message }}
28-
链接: ${{ github.event.head_commit.url }}
29-
作者: ${{ github.event.head_commit.author.name }}
30-
prerelease: false
39+
最新提交: ${{ steps.get_commit_info.outputs.COMMIT_MESSAGE }}
40+
链接: https://github.com/${{ github.repository }}/commit/${{ steps.get_commit_info.outputs.COMMIT_URL }}
41+
作者: ${{ steps.get_commit_info.outputs.COMMIT_AUTHOR }}
42+
prerelease: false
43+
44+
- name: Upload release asset
45+
uses: actions/upload-release-asset@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
upload_url: ${{ steps.create_release.outputs.upload_url }}
50+
asset_path: ./reference_audio.zip
51+
asset_name: reference_audio.zip
52+
asset_content_type: application/zip

0 commit comments

Comments
 (0)
Failed to load comments.