Skip to content

Commit 0f059b6

Browse files
Copilot0xrinegade
andcommitted
Optimize GitHub Actions: build release binaries only on main branch with tags
Co-authored-by: 0xrinegade <[email protected]>
1 parent 8572bff commit 0f059b6

File tree

6 files changed

+141
-27
lines changed

6 files changed

+141
-27
lines changed

.github/workflows/build-all-platforms.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ name: Build All Platforms
33
on:
44
push:
55
branches: [ main, develop ]
6+
tags: [ 'v*' ]
67
pull_request:
78
branches: [ main ]
89
release:
910
types: [ published ]
11+
workflow_dispatch:
1012

1113
jobs:
1214
build-web:
@@ -71,6 +73,7 @@ jobs:
7173
build-android:
7274
runs-on: ubuntu-latest
7375
needs: build-web
76+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
7477
steps:
7578
- name: Checkout code
7679
uses: actions/checkout@v4
@@ -108,6 +111,7 @@ jobs:
108111
build-native-linux:
109112
runs-on: ubuntu-latest
110113
needs: build-web
114+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
111115
steps:
112116
- name: Checkout code
113117
uses: actions/checkout@v4
@@ -146,6 +150,7 @@ jobs:
146150
build-native-windows:
147151
runs-on: windows-latest
148152
needs: build-web
153+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
149154
steps:
150155
- name: Checkout code
151156
uses: actions/checkout@v4
@@ -181,6 +186,7 @@ jobs:
181186
build-native-macos:
182187
runs-on: macos-latest
183188
needs: build-web
189+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
184190
steps:
185191
- name: Checkout code
186192
uses: actions/checkout@v4

.github/workflows/build-android.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ name: Build Android APK
22

33
on:
44
push:
5-
branches: [ main, develop, 'feature/*', 'fix/*', 'copilot/*' ]
6-
paths-ignore:
7-
- 'docs/**'
8-
- '*.md'
9-
pull_request:
10-
branches: [ main, develop ]
5+
branches: [ main ]
6+
tags: [ 'v*' ]
117
paths-ignore:
128
- 'docs/**'
139
- '*.md'
10+
release:
11+
types: [ published ]
1412
workflow_dispatch:
1513

1614
jobs:

.github/workflows/build-linux-native.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ name: Build Linux Native
22

33
on:
44
push:
5-
branches: [ main, develop, 'feature/*', 'fix/*', 'copilot/*' ]
5+
branches: [ main ]
6+
tags: [ 'v*' ]
67
paths-ignore:
78
- 'docs/**'
89
- '*.md'
9-
pull_request:
10-
branches: [ main, develop ]
11-
paths-ignore:
12-
- 'docs/**'
13-
- '*.md'
14-
workflow_dispatch:
1510
release:
1611
types: [ published ]
12+
workflow_dispatch:
1713

1814
jobs:
1915
build-linux-native:

.github/workflows/build-macos-native.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ name: Build macOS Native
22

33
on:
44
push:
5-
branches: [ main, develop, 'feature/*', 'fix/*', 'copilot/*' ]
5+
branches: [ main ]
6+
tags: [ 'v*' ]
67
paths-ignore:
78
- 'docs/**'
89
- '*.md'
9-
pull_request:
10-
branches: [ main, develop ]
11-
paths-ignore:
12-
- 'docs/**'
13-
- '*.md'
14-
workflow_dispatch:
1510
release:
1611
types: [ published ]
12+
workflow_dispatch:
1713

1814
jobs:
1915
build-macos-native:

.github/workflows/build-web.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Build Web Application
2+
3+
on:
4+
push:
5+
branches: [ main, develop, 'feature/*', 'fix/*', 'copilot/*' ]
6+
paths-ignore:
7+
- 'docs/**'
8+
- '*.md'
9+
pull_request:
10+
branches: [ main, develop ]
11+
paths-ignore:
12+
- 'docs/**'
13+
- '*.md'
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-web:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version-file: '.nvmrc'
28+
cache: 'yarn'
29+
30+
- name: Install dependencies
31+
run: |
32+
for i in 1 2 3; do
33+
yarn install --frozen-lockfile && break || sleep 10
34+
done
35+
36+
- name: Build web application
37+
run: ./scripts/build-web.sh
38+
39+
- name: Upload web artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: web-build-${{ github.sha }}
43+
path: deploy_*/
44+
retention-days: 30
45+
46+
build-extensions:
47+
runs-on: ubuntu-latest
48+
needs: build-web
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version-file: '.nvmrc'
57+
cache: 'yarn'
58+
59+
- name: Install dependencies
60+
run: |
61+
for i in 1 2 3; do
62+
yarn install --frozen-lockfile && break || sleep 10
63+
done
64+
65+
- name: Build browser extensions
66+
run: ./scripts/build-extensions.sh
67+
68+
- name: Upload extension artifacts
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: browser-extensions-${{ github.sha }}
72+
path: |
73+
extension/*.zip
74+
extension/extension-build-info.txt
75+
retention-days: 30
76+
77+
test:
78+
runs-on: ubuntu-latest
79+
needs: build-web
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v4
83+
84+
- name: Setup Node.js
85+
uses: actions/setup-node@v4
86+
with:
87+
node-version-file: '.nvmrc'
88+
cache: 'yarn'
89+
90+
- name: Install dependencies
91+
run: |
92+
for i in 1 2 3; do
93+
yarn install --frozen-lockfile && break || sleep 10
94+
done
95+
96+
- name: Download web build artifacts
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: web-build-${{ github.sha }}
100+
path: deploy_latest
101+
102+
- name: Run tests
103+
run: yarn test --watchAll=false --coverage
104+
105+
- name: Install Playwright
106+
run: yarn playwright:install
107+
108+
- name: Run E2E tests
109+
run: yarn test:e2e
110+
env:
111+
# Use local build for E2E tests if needed
112+
PLAYWRIGHT_BASE_URL: http://localhost:3000
113+
114+
- name: Upload test results
115+
uses: actions/upload-artifact@v4
116+
if: always()
117+
with:
118+
name: test-results-${{ github.sha }}
119+
path: |
120+
coverage/
121+
playwright-report/
122+
retention-days: 7

.github/workflows/build-windows-native.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ name: Build Windows Native
22

33
on:
44
push:
5-
branches: [ main, develop, 'feature/*', 'fix/*', 'copilot/*' ]
5+
branches: [ main ]
6+
tags: [ 'v*' ]
67
paths-ignore:
78
- 'docs/**'
89
- '*.md'
9-
pull_request:
10-
branches: [ main, develop ]
11-
paths-ignore:
12-
- 'docs/**'
13-
- '*.md'
14-
workflow_dispatch:
1510
release:
1611
types: [ published ]
12+
workflow_dispatch:
1713

1814
jobs:
1915
build-windows-native:

0 commit comments

Comments
 (0)