Skip to content

Commit 5170062

Browse files
committed
chore: enhance workflows
1 parent ab1f671 commit 5170062

3 files changed

Lines changed: 54 additions & 74 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Build and Test"
2+
description: "Build and Test"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Build Firefox v2
7+
run: npm run build:firefox_v2
8+
- name: Build Firefox v3
9+
run: npm run build:firefox_v3
10+
- name: Build Chrome v2
11+
run: npm run build:chrome_v2
12+
- name: Build Chrome v3
13+
run: npm run build:chrome_v3
14+
- name: Upload bundle
15+
uses: actions/upload-artifact@v4
16+
with:
17+
name: dist
18+
retention-days: 7
19+
path: |
20+
dist_chrome_v2
21+
dist_chrome_v3
22+
dist_firefox_v2
23+
dist_firefox_v3
24+
- name: Install Edge
25+
id: install-edge
26+
run: |
27+
sudo apt-get remove -y microsoft-edge-stable
28+
sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg
29+
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main"
30+
sudo apt-get update
31+
sudo apt-get install -y microsoft-edge-stable=138.0.3351.109-1
32+
microsoft-edge --version
33+
EDGE_PATH=$(which microsoft-edge)
34+
echo "edge-path=$EDGE_PATH" >> $GITHUB_OUTPUT
35+
- name: Test
36+
env:
37+
EDGE_PATH: ${{ steps.install-edge.outputs.edge-path }}
38+
run: |
39+
npx puppeteer browsers install
40+
php -S 0.0.0.0:8899 -t $GITHUB_WORKSPACE/tests/simple-server > /dev/null 2>&1 &
41+
sleep 2
42+
npm run test:e2e

.github/workflows/dev.yml

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ jobs:
5454
if: ${{ needs.check_changes.outputs.src_changed == 'true' || github.event_name == 'workflow_dispatch' }}
5555
steps:
5656
- uses: actions/checkout@v4
57+
- name: Inject Env
58+
run: |
59+
echo "INPUT_PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV
60+
echo "INPUT_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
5761
- uses: pnpm/action-setup@v4
5862
with:
5963
version: 9
@@ -69,43 +73,8 @@ jobs:
6973
TOKEN: ${{ secrets.SNAPSHOT_TOKEN }}
7074
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7175
run: node ./scripts/get-snapshot-version.mjs
72-
- name: Build Firefox v2
73-
run: npm run build:firefox_v2
74-
- name: Build Firefox v3
75-
run: npm run build:firefox_v3
76-
- name: Build Chrome v2
77-
run: npm run build:chrome_v2
78-
- name: Build Chrome v3
79-
run: npm run build:chrome_v3
80-
- name: Upload bundle
81-
uses: actions/upload-artifact@v4
82-
with:
83-
name: dist
84-
retention-days: 7
85-
path: |
86-
dist_chrome_v2
87-
dist_chrome_v3
88-
dist_firefox_v2
89-
dist_firefox_v3
90-
- name: Install Edge
91-
id: install-edge
92-
run: |
93-
sudo apt-get remove -y microsoft-edge-stable
94-
sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg
95-
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main"
96-
sudo apt-get update
97-
sudo apt-get install -y microsoft-edge-stable=138.0.3351.109-1
98-
microsoft-edge --version
99-
EDGE_PATH=$(which microsoft-edge)
100-
echo "edge-path=$EDGE_PATH" >> $GITHUB_OUTPUT
101-
- name: Test
102-
env:
103-
EDGE_PATH: ${{ steps.install-edge.outputs.edge-path }}
104-
run: |
105-
npx puppeteer browsers install
106-
php -S 0.0.0.0:8899 -t $GITHUB_WORKSPACE/tests/simple-server > /dev/null 2>&1 &
107-
sleep 2
108-
npm run test:e2e
76+
- name: Build And Test
77+
uses: ./.github/actions/build-and-test
10978
- name: Publish snapshot
11079
env:
11180
AMO_KEY: ${{ secrets.AMO_KEY }}

.github/workflows/release.yml

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
runs-on: ubuntu-24.04
2525
steps:
2626
- uses: actions/checkout@v4
27+
- name: Inject Env
28+
run: |
29+
echo "INPUT_PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV
30+
echo "INPUT_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
2731
- uses: pnpm/action-setup@v4
2832
with:
2933
version: 9
@@ -34,43 +38,8 @@ jobs:
3438
cache: 'pnpm'
3539
- name: Install dependencies
3640
run: pnpm i --frozen-lockfile
37-
- name: Build Firefox v2
38-
run: npm run build:firefox_v2
39-
- name: Build Firefox v3
40-
run: npm run build:firefox_v3
41-
- name: Build Chrome v2
42-
run: npm run build:chrome_v2
43-
- name: Build Chrome v3
44-
run: npm run build:chrome_v3
45-
- name: Upload bundle
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: dist
49-
retention-days: 7
50-
path: |
51-
dist_chrome_v2
52-
dist_chrome_v3
53-
dist_firefox_v2
54-
dist_firefox_v3
55-
- name: Install Edge
56-
id: install-edge
57-
run: |
58-
sudo apt-get remove -y microsoft-edge-stable
59-
sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg
60-
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main"
61-
sudo apt-get update
62-
sudo apt-get install -y microsoft-edge-stable=138.0.3351.109-1
63-
microsoft-edge --version
64-
EDGE_PATH=$(which microsoft-edge)
65-
echo "edge-path=$EDGE_PATH" >> $GITHUB_OUTPUT
66-
- name: Test
67-
env:
68-
EDGE_PATH: ${{ steps.install-edge.outputs.edge-path }}
69-
run: |
70-
npx puppeteer browsers install
71-
php -S 0.0.0.0:8899 -t $GITHUB_WORKSPACE/tests/simple-server &
72-
sleep 3
73-
npm run test:e2e
41+
- name: Build And Test
42+
uses: ./.github/actions/build-and-test
7443
- name: Pack
7544
env:
7645
AMO_KEY: ${{ secrets.AMO_KEY }}

0 commit comments

Comments
 (0)