-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (69 loc) · 2.08 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (69 loc) · 2.08 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
name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint --if-present
- name: Run tests
run: npm test --if-present
- name: Clean previous build artifacts
run: |
rm -rf dist
rm -f index.js
rm -rf release-package
- name: Build package
run: npm run build
- name: Verify build output
run: |
echo "Build output:"
ls -la dist/
- name: Create release package
run: |
# 创建发布目录
mkdir -p release-package
mkdir -p release-package/dist
# 复制必要文件到发布目录
cp dist/index.js release-package/dist/
cp package.json release-package/
cp README.md release-package/
cp icon.png release-package/
# 如果存在 source map,也复制到 dist 目录
if [ -f "dist/index.js.map" ]; then
cp dist/index.js.map release-package/dist/
fi
# 创建压缩包
cd release-package
zip -r ../orca-tabs-plugin.zip .
tar -czf ../orca-tabs-plugin.tar.gz .
cd ..
echo "Release package created:"
ls -la orca-tabs-plugin.*
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
orca-tabs-plugin.zip
orca-tabs-plugin.tar.gz
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}