-
Notifications
You must be signed in to change notification settings - Fork 608
99 lines (85 loc) · 3.07 KB
/
Copy pathflowcheck.yml
File metadata and controls
99 lines (85 loc) · 3.07 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
name: Flow Check
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch name to build, leave empty to auto-select latest tmp/YYYYMMDD branch'
required: false
default: ''
type: string
notify_larkbot:
description: 'Notify LarkBot (true/false)'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
push:
branches:
- master
jobs:
flow-check:
runs-on: ubuntu-latest
steps:
- name: Resolve target branch
id: resolve-branch
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_BRANCH: ${{ github.ref_name }}
BRANCH_OVERRIDE: ${{ github.event.inputs.branch || '' }}
NOTIFY_LARKBOT: ${{ github.event.inputs.notify_larkbot || 'true' }}
run: |
set -euo pipefail
target_branch="${BRANCH_OVERRIDE:-}"
if [[ -z "$target_branch" ]]; then
if [[ "${EVENT_NAME:-}" == "push" ]]; then
target_branch="${PUSH_BRANCH:-}"
fi
fi
if [[ -z "$target_branch" ]]; then
target_branch="$(
git ls-remote --heads https://github.com/RabbyHub/Rabby.git 'refs/heads/tmp/*' \
| awk -F'refs/heads/' '{print $2}' \
| grep -E '^tmp/[0-9]{8}$' \
| sort -t/ -k2,2r \
| head -n 1
)"
fi
if [[ -z "$target_branch" ]]; then
echo "No remote branch matching tmp/YYYYMMDD was found." >&2
exit 1
fi
echo "target_branch=$target_branch" >> "$GITHUB_OUTPUT"
echo "notify_larkbot=${NOTIFY_LARKBOT:-true}" >> "$GITHUB_OUTPUT"
echo "Selected branch: $target_branch"
echo "Notify LarkBot: ${NOTIFY_LARKBOT:-true}"
- name: Clone Rabby repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
repository: RabbyHub/Rabby
ref: ${{ steps.resolve-branch.outputs.target_branch }}
path: rabby
- name: Setup Node.js 22
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '22'
cache: yarn
cache-dependency-path: rabby/yarn.lock
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
working-directory: rabby
run: yarn install --immutable
- name: Disable minimize in webpack config
working-directory: rabby
run: |
sed -i 's/minimize: true,/minimize: false,/' build/webpack.pro.config.js
- name: Build production
working-directory: rabby
run: yarn build:pro
- name: Run chrome-extension-automator
env:
RABBY_LARK_CHAT_URL: ${{ secrets.RABBY_LARK_CHAT_URL }}
RABBY_LARK_CHAT_SECRET: ${{ secrets.RABBY_LARK_CHAT_SECRET }}
run: npx -y chrome-extension-automator rabby/dist ${{ steps.resolve-branch.outputs.target_branch }} ${{ steps.resolve-branch.outputs.notify_larkbot }}