-
Notifications
You must be signed in to change notification settings - Fork 349
177 lines (169 loc) · 4.68 KB
/
dev.yml
File metadata and controls
177 lines (169 loc) · 4.68 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: dev
on:
push:
branches:
- dev
- fix/*
- feat/*
workflow_dispatch:
inputs:
platform:
description: 'Platform(amo,cws,xpi,edge,crx)'
required: true
type: string
version:
description: 'Version'
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_changes:
runs-on: ubuntu-24.04
outputs:
locale_changed: ${{ steps.filter.outputs.locale }}
docs_changed: ${{ steps.filter.outputs.docs }}
src_changed: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref_name }}
filters: |
locale:
- 'locale/**'
docs:
- 'docs/**'
src:
- 'src/**'
- 'public/**'
- 'scripts/**'
- 'tests/**'
- 'patches/**'
- 'rsbuild.config.ts'
- 'pnpm-lock.yaml'
build:
needs: check_changes
runs-on: ubuntu-24.04
if: ${{ needs.check_changes.outputs.src_changed == 'true' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
- name: Inject Env
run: |
echo "INPUT_PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV
echo "INPUT_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Get snapshot version
env:
TOKEN: ${{ secrets.SNAPSHOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node ./scripts/get-snapshot-version.mjs
- name: Build And Test
uses: ./.github/actions/build-and-test
- name: Publish snapshot
env:
AMO_KEY: ${{ secrets.AMO_KEY }}
AMO_SECRET: ${{ secrets.AMO_SECRET }}
CRX_PRIV_KEY: ${{ secrets.CRX_PRIV_KEY }}
PACK_PLATFORM: xpi,crx
DEBUG: '*'
run: npm run pack
- name: Upload snapshot release
uses: actions/upload-artifact@v4
with:
name: release
retention-days: 7
path: temp/release
sync-locale:
needs: check_changes
runs-on: ubuntu-24.04
if: ${{ needs.check_changes.outputs.locale_changed == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Sort
run: node ./locale/sort-origin.js
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: sync-locale
folder: locale
clean: false
commit-message: '[skip ci] sync locale'
build-docs:
needs: check_changes
runs-on: ubuntu-24.04
if: ${{ needs.check_changes.outputs.docs_changed == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
cd $GITHUB_WORKSPACE/docs
pnpm i --frozen-lockfile
- name: Build
run: |
cd $GITHUB_WORKSPACE/docs
npm run build
cp $GITHUB_WORKSPACE/scripts/www/* $GITHUB_WORKSPACE/docs/doc_build/
- name: Upload
uses: actions/upload-artifact@v4
with:
name: docs
retention-days: 1
path: docs/doc_build
deploy-docs-cloudflare:
needs: build-docs
runs-on: ubuntu-24.04
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download
uses: actions/download-artifact@v5
with:
name: docs
path: docs
- name: Deploy Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
run: npx wrangler@3 pages deploy docs --project-name=${{ vars.CF_PAGE_NAME }} --branch=dev
deploy-docs-eo:
needs: build-docs
runs-on: ubuntu-24.04
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download
uses: actions/download-artifact@v5
with:
name: docs
path: docs
- name: Deploy EdgeOne Pages
run: npx edgeone pages deploy $GITHUB_WORKSPACE/docs -n ${{ vars.EO_PAGE_NAME }} -t ${{ secrets.EO_PAGE_TOKEN }} -e preview