68 lines
1.5 KiB
YAML
68 lines
1.5 KiB
YAML
name: 构建扩展程序
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
name: 构建扩展程序
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
EXTENSION_ID: kphoaomopljjiofeaigjmbagmbdaamhh
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
name: 检出代码
|
|
|
|
- name: 设置 Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: 安装依赖
|
|
run: npm install
|
|
|
|
- name: 构建扩展程序
|
|
run: npm run build
|
|
|
|
- name: 上传工件
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: artifact-${{ gitea.sha }}
|
|
path: dist/
|
|
|
|
publish:
|
|
name: 发布至 Chrome 应用商店
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
name: 检出代码
|
|
|
|
- name: 下载构建工件
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: artifact-${{ gitea.sha }}
|
|
|
|
- uses: actions/setup-node@v2-beta
|
|
name: 设置 Node.js
|
|
with:
|
|
node-version: "16.10"
|
|
|
|
- name: 安装提交器
|
|
run: |-
|
|
npm install -g chrome-webstore-upload-cli
|
|
|
|
- name: 上传扩展程序
|
|
run: |-
|
|
chrome-webstore-upload upload \\
|
|
--source artifact-${{ gitea.sha }}.zip \\
|
|
--client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \\
|
|
--client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \\
|
|
--refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
|
|
|