-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (118 loc) · 4.36 KB
/
release.yml
File metadata and controls
148 lines (118 loc) · 4.36 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 1.0.6)'
required: true
type: string
prerelease:
description: 'Is this a pre-release?'
required: false
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
- name: Install dependencies
run: |
npm install
npm install -g @vscode/vsce
- name: Rebuild native modules
run: |
npm rebuild --unsafe-perm
- name: Get version
id: version
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
fi
- name: Update package.json version
run: |
echo "Current version in package.json: $(node -p "require('./package.json').version")"
echo "Target version: ${{ steps.version.outputs.version }}"
npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version || echo "Version update completed"
- name: Compile TypeScript
run: |
npm run compile || echo "Compile completed with warnings"
- name: Package extension
run: |
vsce package --skip-license
- name: List and rename VSIX file
run: |
echo "Files in directory:"
ls -la *.vsix || echo "No VSIX files found"
CURRENT_FILE=$(ls *.vsix | head -1)
TARGET_FILE="mpy-studio-${{ steps.version.outputs.version }}.vsix"
echo "Current file: $CURRENT_FILE"
echo "Target file: $TARGET_FILE"
if [ "$CURRENT_FILE" != "$TARGET_FILE" ]; then
cp "$CURRENT_FILE" "$TARGET_FILE"
echo "Created $TARGET_FILE from $CURRENT_FILE"
else
echo "File already has correct name: $TARGET_FILE"
fi
- name: Create Release Notes
id: release_notes
run: |
cat << EOF > release-notes.md
# MPY-Studio v${{ steps.version.outputs.version }}
## 🎉 新版本发布
### 📦 安装方式
1. **VSCode 扩展市场**(推荐)
- 在 VSCode 中搜索 "mpy-studio"
- 点击安装即可
2. **手动安装 VSIX**
- 下载下方的 \`mpy-studio-${{ steps.version.outputs.version }}.vsix\` 文件
- 在 VSCode 中按 \`Ctrl+Shift+P\`
- 输入 "Install from VSIX"
- 选择下载的文件进行安装
### ✨ 更新内容
- 修复构建脚本和依赖问题
- 优化代码结构
- 提升性能和稳定性
### 🔗 相关链接
- [项目主页](https://github.com/sheacoding/mpy-studio)
- [问题反馈](https://github.com/sheacoding/mpy-studio/issues)
- [Fork 来源](https://gitee.com/ai_mpy/mpy-studio)
### 📝 完整更新日志
查看 [Commits](https://github.com/sheacoding/mpy-studio/commits/v${{ steps.version.outputs.version }})
---
**构建信息**
- 构建时间: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
- Commit: ${{ github.sha }}
- Node.js: 22.x
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: MPY-Studio v${{ steps.version.outputs.version }}
body_path: release-notes.md
draft: false
prerelease: ${{ github.event.inputs.prerelease || false }}
files: |
mpy-studio-${{ steps.version.outputs.version }}.vsix
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Release Artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ steps.version.outputs.version }}
path: mpy-studio-${{ steps.version.outputs.version }}.vsix
retention-days: 90