Skip to content

Commit 53256e8

Browse files
committed
添加自动部署脚本
1 parent 3e5ced3 commit 53256e8

File tree

4 files changed

+235
-2
lines changed

4 files changed

+235
-2
lines changed

.github/RELEASE.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# InfoFlow Extension Release Configuration
2+
3+
## Automated Release Process
4+
5+
This project is configured for automated releases of the InfoFlow browser extension using GitHub Actions.
6+
7+
### Release Workflow
8+
9+
The release workflow `.github/workflows/release.yml` will:
10+
11+
1. **On push to main branch:**
12+
- Install dependencies for InfoFlow extension
13+
- Run type checking
14+
- Build Chrome extension
15+
- Build Firefox extension
16+
- Package both extensions into ZIP files
17+
- Create GitHub Release with version tag
18+
- Upload Chrome and Firefox extension files
19+
20+
2. **On pull requests:**
21+
- Run build validation without publishing
22+
- Upload build artifacts for testing
23+
24+
### Build Process
25+
26+
The CI script will:
27+
- Build Chrome extension (`chrome.zip`)
28+
- Build Firefox extension (`firefox.zip`)
29+
- Use version from `package.json` for release tag
30+
- Create GitHub Release with both extension files
31+
32+
### Manual Release Commands
33+
34+
For local development and testing:
35+
36+
```bash
37+
# Navigate to InfoFlow directory
38+
cd apps/InfoFlow
39+
40+
# Build both extensions
41+
pnpm release
42+
43+
# Build specific browser extension
44+
pnpm build # Chrome
45+
pnpm build:firefox # Firefox
46+
47+
# Package extensions
48+
pnpm zip # Chrome ZIP
49+
pnpm zip:firefox # Firefox ZIP
50+
51+
# Complete release preparation
52+
pnpm release:prepare
53+
```
54+
55+
### Version Management
56+
57+
- Version is managed in `apps/InfoFlow/package.json`
58+
- Release tags use format `v{version}` (e.g., `v1.0.0`)
59+
- To update version: `npm version patch` in InfoFlow directory
60+
61+
### Build Artifacts
62+
63+
- **Chrome Extension**: `apps/InfoFlow/chrome.zip`
64+
- **Firefox Extension**: `apps/InfoFlow/firefox.zip`
65+
- **Build Output**: `apps/InfoFlow/dist/`
66+
67+
### Installation
68+
69+
After release, users can:
70+
1. Download extension ZIP files from GitHub Release
71+
2. Unzip the files
72+
3. Load extension in browser developer mode
73+
4. Chrome: `chrome://extensions/` → Load unpacked
74+
5. Firefox: `about:debugging` → This Firefox → Load Temporary Add-on
75+
76+
### Release Notes Format
77+
78+
Each release includes:
79+
- Version number and tag
80+
- Installation instructions for both browsers
81+
- List of included files
82+
- Automated changelog from main branch

.github/workflows/release.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Release InfoFlow Extension
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: 'pnpm'
28+
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v3
31+
with:
32+
version: 10
33+
34+
- name: Install dependencies
35+
run: |
36+
cd apps/InfoFlow
37+
pnpm install
38+
39+
- name: Type check
40+
run: |
41+
cd apps/InfoFlow
42+
pnpm tsc
43+
44+
- name: Build Chrome extension
45+
run: |
46+
cd apps/InfoFlow
47+
pnpm build
48+
49+
- name: Build Firefox extension
50+
run: |
51+
cd apps/InfoFlow
52+
pnpm build:firefox
53+
54+
- name: Package extensions
55+
run: |
56+
cd apps/InfoFlow
57+
pnpm zip
58+
pnpm zip:firefox
59+
60+
- name: Get version
61+
id: get_version
62+
run: |
63+
cd apps/InfoFlow
64+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
65+
echo "tag_name=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
66+
67+
- name: Create Release
68+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
tag_name: ${{ steps.get_version.outputs.tag_name }}
72+
name: InfoFlow Extension ${{ steps.get_version.outputs.tag_name }}
73+
body: |
74+
## InfoFlow Extension Release ${{ steps.get_version.outputs.tag_name }}
75+
76+
### Changes
77+
- Automated release from main branch
78+
79+
### Installation
80+
- **Chrome**: Download `chrome.zip` and unzip, then load extension in developer mode
81+
- **Firefox**: Download `firefox.zip` and unzip, then load temporary extension
82+
83+
### Files
84+
- `chrome.zip` - Chrome extension
85+
- `firefox.zip` - Firefox extension
86+
files: |
87+
apps/InfoFlow/chrome.zip
88+
apps/InfoFlow/firefox.zip
89+
draft: false
90+
prerelease: false
91+
92+
build-only:
93+
runs-on: ubuntu-latest
94+
if: github.event_name == 'pull_request'
95+
96+
steps:
97+
- name: Checkout code
98+
uses: actions/checkout@v4
99+
100+
- name: Setup Node.js
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version: '20'
104+
cache: 'pnpm'
105+
106+
- name: Install pnpm
107+
uses: pnpm/action-setup@v3
108+
with:
109+
version: 10
110+
111+
- name: Install dependencies
112+
run: |
113+
cd apps/InfoFlow
114+
pnpm install
115+
116+
- name: Type check
117+
run: |
118+
cd apps/InfoFlow
119+
pnpm tsc
120+
121+
- name: Build Chrome extension
122+
run: |
123+
cd apps/InfoFlow
124+
pnpm build
125+
126+
- name: Build Firefox extension
127+
run: |
128+
cd apps/InfoFlow
129+
pnpm build:firefox
130+
131+
- name: Package extensions
132+
run: |
133+
cd apps/InfoFlow
134+
pnpm zip
135+
pnpm zip:firefox
136+
137+
- name: Upload artifacts
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: extension-builds
141+
path: |
142+
apps/InfoFlow/chrome.zip
143+
apps/InfoFlow/firefox.zip

apps/InfoFlow/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"zip": "wxt zip",
1414
"zip:firefox": "wxt zip -b firefox",
1515
"compile": "vue-tsc --noEmit",
16-
"postinstall": "wxt prepare"
16+
"postinstall": "wxt prepare",
17+
"release": "pnpm build && pnpm build:firefox && pnpm zip && pnpm zip:firefox",
18+
"release:version": "npm version patch",
19+
"release:prepare": "pnpm install && pnpm tsc && pnpm release"
1720
},
1821
"dependencies": {
1922
"@primeuix/themes": "^1.2.3",

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"main": "index.js",
66
"scripts": {
77
"translate-md": "mcp_agent_ts-translate-md translate -i README_zh.md -o README.md -l \"English\"",
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"release": "pnpm install && pnpm tsc && pnpm --recursive --parallel run build",
10+
"release:ci": "pnpm install && pnpm tsc && pnpm --recursive --parallel run build:lib",
11+
"build:backend": "cd apps/backend && pnpm build:lib",
12+
"build:frontend": "cd apps/website-frontend && pnpm build",
13+
"build:extension": "cd apps/InfoFlow && pnpm build"
914
},
1015
"keywords": [],
1116
"author": "",

0 commit comments

Comments
 (0)