Skip to content

Commit 124fc73

Browse files
committed
chore: github action
1 parent 631c6fc commit 124fc73

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 监听以 v 开头的 tag,例如 v1.0.0
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest # 在 Ubuntu 系统上运行
11+
12+
steps:
13+
# 检出代码
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
# 设置 Node.js 环境
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '16' # 设置 Node.js 版本
22+
23+
# 安装 pnpm
24+
- name: Install pnpm
25+
run: npm install -g pnpm
26+
27+
# 安装依赖
28+
- name: Install dependencies
29+
run: pnpm install
30+
31+
# 构建 Vue 项目
32+
- name: Build Vue project
33+
run: pnpm run build
34+
35+
# 创建 tar.gz 压缩包
36+
- name: Create tar.gz archive of dist
37+
run: |
38+
cd dist
39+
tar -czf ../frontend.tar.gz . # 将 dist 目录中的文件压缩为 dist.tar.gz
40+
41+
# 上传构建产物和压缩包到 Release
42+
- name: Create GitHub Release
43+
uses: softprops/action-gh-release@v1
44+
with:
45+
files: 'dist/**,frontend.tar.gz' # 同时上传 dist/ 目录和 dist.tar.gz 压缩包
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "frontend",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "1.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

0 commit comments

Comments
 (0)