Skip to content

Commit 32d0df2

Browse files
authored
Merge pull request #74 from open-webui/main
refac
2 parents 2fdf001 + 4076e12 commit 32d0df2

1 file changed

Lines changed: 81 additions & 39 deletions

File tree

.github/workflows/release.yml

Lines changed: 81 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,35 @@ on:
66
- release
77

88
jobs:
9-
build:
10-
name: Build and Package
9+
compile:
10+
name: Compile (Typecheck + Vite Build)
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
cache: 'npm'
21+
22+
- name: Install Dependencies
23+
run: npm ci
24+
25+
- name: Typecheck and Build
26+
run: npm run build
27+
28+
- name: Upload Compiled Output
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: compiled-output
32+
path: out/
33+
retention-days: 1
34+
35+
package:
36+
name: Package (${{ matrix.os }}-${{ matrix.arch }})
37+
needs: compile
1138
runs-on: ${{ matrix.os }}
1239
strategy:
1340
fail-fast: false
@@ -29,14 +56,28 @@ jobs:
2956
uses: actions/setup-node@v4
3057
with:
3158
node-version: 22
32-
cache: "npm"
59+
cache: 'npm'
3360

3461
- name: Install Dependencies
3562
run: npm ci
3663

64+
- name: Download Compiled Output
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: compiled-output
68+
path: out/
69+
70+
# ── Flatpak setup (Linux only) ──
71+
- name: Cache Flatpak SDKs
72+
if: matrix.os == 'ubuntu-latest'
73+
uses: actions/cache@v4
74+
with:
75+
path: ~/.local/share/flatpak
76+
key: flatpak-sdk-23.08-electron2-${{ runner.os }}
77+
3778
- name: Install Flatpak build tools
3879
id: flatpak
39-
if: ${{ matrix.os == 'ubuntu-latest' }}
80+
if: matrix.os == 'ubuntu-latest'
4081
continue-on-error: true
4182
run: |
4283
sudo apt-get update
@@ -45,9 +86,10 @@ jobs:
4586
flatpak install --user -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08
4687
flatpak install --user -y flathub org.electronjs.Electron2.BaseApp//23.08
4788
89+
# ── Apple codesigning (macOS only) ──
4890
- name: Install Apple codesigning certificate
4991
id: apple_cert
50-
if: ${{ matrix.os == 'macos-latest' }}
92+
if: matrix.os == 'macos-latest'
5193
continue-on-error: true
5294
env:
5395
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
@@ -67,54 +109,53 @@ jobs:
67109
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
68110
security list-keychain -d user -s $KEYCHAIN_PATH
69111
70-
# Build commands — use electron-builder directly to pass arch flags
71-
- name: Create Windows Builds
112+
# ── Platform packaging ──
113+
- name: Package for Windows
72114
id: win_build
73-
if: ${{ matrix.os == 'windows-latest' }}
115+
if: matrix.os == 'windows-latest'
74116
continue-on-error: true
75-
run: npm run build && npx electron-builder --win --${{ matrix.arch }} --publish never
117+
run: npx electron-builder --win --${{ matrix.arch }} --publish never
76118

77-
- name: Create Windows Builds (unsigned fallback)
78-
if: ${{ matrix.os == 'windows-latest' && steps.win_build.outcome == 'failure' }}
119+
- name: Package for Windows (unsigned fallback)
120+
if: matrix.os == 'windows-latest' && steps.win_build.outcome == 'failure'
79121
env:
80122
WIN_CSC_LINK: ''
81123
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
82124
run: |
83125
rm -rf dist/
84-
npm run build && npx electron-builder --win --${{ matrix.arch }} --publish never
126+
npx electron-builder --win --${{ matrix.arch }} --publish never
85127
86-
- name: Create macOS Builds (signed + notarized)
128+
- name: Package for macOS (signed + notarized)
87129
id: mac_build_signed
88-
if: ${{ matrix.os == 'macos-latest' && steps.apple_cert.outcome == 'success' }}
130+
if: matrix.os == 'macos-latest' && steps.apple_cert.outcome == 'success'
89131
continue-on-error: true
90132
env:
91133
APPLE_ID: ${{ secrets.APPLE_ID }}
92134
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
93135
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
94-
run: npm run build && npx electron-builder --mac --${{ matrix.arch }} --publish never
136+
run: npx electron-builder --mac --${{ matrix.arch }} --publish never
95137

96-
- name: Create macOS Builds (unsigned fallback)
97-
if: ${{ matrix.os == 'macos-latest' && (steps.apple_cert.outcome != 'success' || steps.mac_build_signed.outcome == 'failure') }}
138+
- name: Package for macOS (unsigned fallback)
139+
if: matrix.os == 'macos-latest' && (steps.apple_cert.outcome != 'success' || steps.mac_build_signed.outcome == 'failure')
98140
env:
99141
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
100142
run: |
101143
rm -rf dist/
102-
npm run build && npx electron-builder --mac --${{ matrix.arch }} -c.mac.notarize=null --publish never
144+
npx electron-builder --mac --${{ matrix.arch }} -c.mac.notarize=null --publish never
103145
104-
- name: Create Linux Builds
105-
if: ${{ matrix.os == 'ubuntu-latest' }}
146+
- name: Package for Linux
147+
if: matrix.os == 'ubuntu-latest'
106148
run: |
107-
npm run build
108149
if [ "${{ steps.flatpak.outcome }}" == "success" ]; then
109150
npx electron-builder --linux --${{ matrix.arch }} --publish never
110151
else
111152
echo "Flatpak not available, building without flatpak"
112153
npx electron-builder --linux AppImage deb snap --${{ matrix.arch }} --publish never
113154
fi
114155
115-
# Sign Windows executable after build
156+
# ── Windows code signing ──
116157
- name: Azure Trusted Signing (Windows Only)
117-
if: ${{ matrix.os == 'windows-latest' }}
158+
if: matrix.os == 'windows-latest'
118159
continue-on-error: true
119160
uses: azure/trusted-signing-action@v0.5.1
120161
with:
@@ -127,12 +168,7 @@ jobs:
127168
files-folder: dist
128169
files-folder-filter: exe
129170

130-
- name: List files for debugging
131-
shell: bash
132-
run: |
133-
echo "Files in dist directory:"
134-
ls -la dist/ || echo "dist directory not found"
135-
171+
# ── Upload release artifacts ──
136172
- name: Upload Artifacts
137173
uses: actions/upload-artifact@v4
138174
with:
@@ -153,14 +189,24 @@ jobs:
153189
if-no-files-found: warn
154190

155191
release:
156-
needs: build
157-
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/release'
192+
name: Create GitHub Release
193+
needs: package
194+
if: >-
195+
github.event_name == 'push' &&
196+
github.ref == 'refs/heads/release' &&
197+
!cancelled() &&
198+
needs.package.result != 'failure'
158199
runs-on: ubuntu-latest
159200
permissions:
160201
contents: write
161202
steps:
162203
- name: Checkout Repository
163204
uses: actions/checkout@v4
205+
with:
206+
sparse-checkout: |
207+
package.json
208+
CHANGELOG.md
209+
sparse-checkout-cone-mode: false
164210

165211
- name: Get version from package.json
166212
id: version
@@ -186,16 +232,12 @@ jobs:
186232
187233
- name: Download Artifacts
188234
uses: actions/download-artifact@v4
189-
190-
- name: List downloaded artifacts
191-
run: |
192-
echo "Downloaded artifacts:"
193-
find . -type f | grep -E "\.(exe|zip|dmg|pkg|deb|rpm|AppImage|flatpak|tar\.gz|yml|blockmap)$" || echo "No package files found"
194-
ls -laR
235+
with:
236+
pattern: '*-*'
237+
merge-multiple: false
195238

196239
- name: Create Release
197-
id: create_release
198-
uses: softprops/action-gh-release@v1
240+
uses: softprops/action-gh-release@v2
199241
env:
200242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201243
with:

0 commit comments

Comments
 (0)