Skip to content

Commit 23b542e

Browse files
committed
chore(ci): 新增 tag 自动打包发布 release 工作流
1 parent 92b3395 commit 23b542e

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: '要发布的 tag(需已存在)'
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: 解析目标 tag
26+
id: tag
27+
run: |
28+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
29+
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "name=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
32+
fi
33+
34+
- name: 打包核心 skill 文件 zip
35+
run: |
36+
ZIP_NAME="alibaba-java-development-guide-${{ steps.tag.outputs.name }}.zip"
37+
# 仅打包 skill 本体:SKILL.md、data/、project/、README.md、memory.md
38+
zip -r "$ZIP_NAME" SKILL.md README.md memory.md data project
39+
echo "---产物---"
40+
ls -lh "$ZIP_NAME"
41+
echo "---包内文件清单---"
42+
unzip -l "$ZIP_NAME"
43+
44+
- name: 创建 Release 并上传 zip
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
gh release create "${{ steps.tag.outputs.name }}" \
49+
"alibaba-java-development-guide-${{ steps.tag.outputs.name }}.zip" \
50+
--title "Release ${{ steps.tag.outputs.name }}" \
51+
--generate-notes \
52+
--verify-tag

0 commit comments

Comments
 (0)