Skip to content

添加自动部署脚本 #1

添加自动部署脚本

添加自动部署脚本 #1

Workflow file for this run

name: Release InfoFlow Extension
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: Install dependencies
run: |
cd apps/InfoFlow
pnpm install
- name: Type check
run: |
cd apps/InfoFlow
pnpm tsc
- name: Build Chrome extension
run: |
cd apps/InfoFlow
pnpm build
- name: Build Firefox extension
run: |
cd apps/InfoFlow
pnpm build:firefox
- name: Package extensions
run: |
cd apps/InfoFlow
pnpm zip
pnpm zip:firefox
- name: Get version
id: get_version
run: |
cd apps/InfoFlow
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "tag_name=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create Release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_version.outputs.tag_name }}
name: InfoFlow Extension ${{ steps.get_version.outputs.tag_name }}
body: |
## InfoFlow Extension Release ${{ steps.get_version.outputs.tag_name }}
### Changes
- Automated release from main branch
### Installation
- **Chrome**: Download `chrome.zip` and unzip, then load extension in developer mode
- **Firefox**: Download `firefox.zip` and unzip, then load temporary extension
### Files
- `chrome.zip` - Chrome extension
- `firefox.zip` - Firefox extension
files: |
apps/InfoFlow/chrome.zip
apps/InfoFlow/firefox.zip
draft: false
prerelease: false
build-only:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: Install dependencies
run: |
cd apps/InfoFlow
pnpm install
- name: Type check
run: |
cd apps/InfoFlow
pnpm tsc
- name: Build Chrome extension
run: |
cd apps/InfoFlow
pnpm build
- name: Build Firefox extension
run: |
cd apps/InfoFlow
pnpm build:firefox
- name: Package extensions
run: |
cd apps/InfoFlow
pnpm zip
pnpm zip:firefox
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: extension-builds
path: |
apps/InfoFlow/chrome.zip
apps/InfoFlow/firefox.zip