Skip to content

Commit 62e8569

Browse files
committed
perf: change build
1 parent da5fa40 commit 62e8569

1 file changed

Lines changed: 30 additions & 134 deletions

File tree

.github/workflows/build.yml

Lines changed: 30 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,23 @@ jobs:
5454

5555
build:
5656
name: build tauri app
57-
runs-on: ${{ matrix.os }}
5857
needs: pre-build
59-
60-
strategy:
58+
permissions:
59+
contents: write
60+
. strategy:
6161
fail-fast: false
6262
matrix:
63-
os: [macos-14, windows-latest]
63+
include:
64+
- platform: 'macos-latest' # for Arm based macs (M1 and above).
65+
args: '--target aarch64-apple-darwin'
66+
- platform: 'macos-latest' # for Intel based macs.
67+
args: '--target x86_64-apple-darwin'
68+
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
69+
args: ''
70+
- platform: 'windows-latest'
71+
args: ''
6472

73+
runs-on: ${{ matrix.os }}
6574
steps:
6675
- name: Check out git repository
6776
uses: actions/checkout@v4
@@ -72,126 +81,34 @@ jobs:
7281
name: go-client-binaries
7382
path: go-client/build/
7483

75-
- name: Setup Go
76-
uses: actions/setup-go@v4
77-
with:
78-
go-version: "1.25"
79-
8084
- name: Install Go client for current platform
8185
run: make install
8286
working-directory: go-client
8387

84-
- name: Setup pnpm
85-
uses: pnpm/action-setup@v4
86-
8788
- name: Setup Node.js
8889
uses: actions/setup-node@v4
8990
with:
9091
node-version: "23"
91-
cache: "pnpm"
92+
93+
- name: Install Rust stable
94+
uses: dtolnay/rust-toolchain@stable
95+
with:
96+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
97+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
9298

9399
- name: Install system dependencies (Ubuntu)
94100
if: matrix.os == 'ubuntu-latest'
95101
run: |
96102
sudo apt-get update
97103
sudo apt-get install -y libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf
98104
99-
- name: Install system dependencies (macOS)
100-
if: matrix.os == 'macos-14'
101-
run: |
102-
brew install create-dmg
103-
104-
- name: Install WiX Toolset (Windows)
105-
if: matrix.os == 'windows-latest'
106-
run: |
107-
# Enable VBSCRIPT feature required for MSI packages
108-
Enable-WindowsOptionalFeature -Online -FeatureName "VBScript" -All
109-
# Install WiX Toolset using winget (Windows Package Manager)
110-
winget install Microsoft.WiXToolset
111-
# Refresh environment variables
112-
refreshenv
113-
# Verify installation
114-
candle.exe -?
115-
light.exe -?
116-
# Get WiX installation path
117-
$wixPath = (Get-Command candle.exe).Source | Split-Path -Parent
118-
echo "WiX installed at: $wixPath"
119-
# Set environment variables for Tauri 2.0
120-
echo "WIX=$wixPath" | Out-File -FilePath $env:GITHUB_ENV -Append
121-
echo "WIX_ROOT=$wixPath" | Out-File -FilePath $env:GITHUB_ENV -Append
122-
123-
- name: Install Rust
124-
uses: dtolnay/rust-toolchain@stable
125-
with:
126-
components: rustfmt, clippy
127-
128-
- name: Cache Rust dependencies
129-
uses: actions/cache@v4
130-
with:
131-
path: |
132-
~/.cargo/bin/
133-
~/.cargo/registry/index/
134-
~/.cargo/registry/cache/
135-
~/.cargo/git/db/
136-
src-tauri/target/
137-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
138-
restore-keys: |
139-
${{ runner.os }}-cargo-
140-
141-
- name: Install Tauri CLI
142-
run: cargo install tauri-cli@^2.0
143-
env:
144-
# Ensure WiX is available for Tauri CLI
145-
WIX: C:\WixTools
146-
WIX_ROOT: C:\WixTools
147-
148105
- name: Install frontend dependencies
149106
run: pnpm install
150107

151-
- name: Build frontend
152-
run: pnpm generate
153-
154-
- name: Verify Windows build dependencies (Windows)
155-
if: matrix.os == 'windows-latest'
156-
run: |
157-
echo "Verifying Windows build dependencies..."
158-
# Check WiX tools
159-
candle.exe -?
160-
light.exe -?
161-
echo "WiX tools are working correctly"
162-
# Check VBScript feature
163-
$vbScript = Get-WindowsOptionalFeature -Online -FeatureName "VBScript"
164-
if ($vbScript.State -eq "Enabled") {
165-
echo "VBScript feature is enabled"
166-
} else {
167-
echo "WARNING: VBScript feature is not enabled"
168-
}
169-
# Check WebView2
170-
$webview2 = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" -ErrorAction SilentlyContinue
171-
if ($webview2) {
172-
echo "WebView2 is installed: $($webview2.pv)"
173-
} else {
174-
echo "WebView2 will be installed by the installer"
175-
}
176-
177-
- name: Build Tauri app (Windows)
178-
if: matrix.os == 'windows-latest'
179-
run: pnpm tauri:build
180-
env:
181-
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
182-
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
183-
XCODE_APP_TEAM_ID: ${{ secrets.XCODE_APP_TEAM_ID }}
184-
XCODE_APP_LOADER_EMAIL: ${{ secrets.XCODE_APP_LOADER_EMAIL }}
185-
XCODE_APP_LOADER_PASSWORD: ${{ secrets.XCODE_APP_LOADER_PASSWORD }}
186-
BUILD_CERTIFICATE_BASE64: ${{ secrets.CSC_LINK }}
187-
P12_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
188-
CSC_LINK: ${{ secrets.CSC_LINK }}
189-
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
190-
191-
- name: Build Tauri app (macOS)
192-
if: matrix.os == 'macos-14'
193-
run: pnpm tauri:build
108+
- name: Build Tauri app
109+
uses: tauri-apps/tauri-action@v0
194110
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195112
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
196113
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
197114
XCODE_APP_TEAM_ID: ${{ secrets.XCODE_APP_TEAM_ID }}
@@ -201,25 +118,15 @@ jobs:
201118
P12_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
202119
CSC_LINK: ${{ secrets.CSC_LINK }}
203120
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
204-
# Windows-specific environment variables
205-
WIX: C:\WixTools
206-
WIX_ROOT: C:\WixTools
207-
208-
- name: Upload artifacts
209-
uses: actions/upload-artifact@v4
210121
with:
211-
name: ${{ matrix.os }}-app
212-
path: |
213-
src-tauri/target/release/bundle/deb/*.deb
214-
src-tauri/target/release/bundle/rpm/*.rpm
215-
src-tauri/target/release/bundle/appimage/*.AppImage
216-
src-tauri/target/release/bundle/dmg/*.dmg
217-
src-tauri/target/release/bundle/macos/*.app
218-
src-tauri/target/release/bundle/nsis/*.exe
219-
src-tauri/target/release/bundle/msi/*.msi
122+
tagName: ${{ github.ref_name }}
123+
releaseName: "JumpServer Client v__VERSION__"
124+
releaseBody: "See the assets to download this version and install."
125+
releaseDraft: true
126+
prerelease: false
220127

221128
release:
222-
name: create release
129+
name: create latest.json
223130
runs-on: ubuntu-latest
224131
needs: [pre-build, build]
225132
if: startsWith(github.ref, 'refs/tags/')
@@ -228,11 +135,6 @@ jobs:
228135
- name: Check out git repository
229136
uses: actions/checkout@v4
230137

231-
- name: Download all artifacts
232-
uses: actions/download-artifact@v4
233-
with:
234-
path: artifacts
235-
236138
- name: Generate latest.json
237139
run: |
238140
echo '{
@@ -259,15 +161,9 @@ jobs:
259161
}
260162
}' > latest.json
261163
262-
- name: Create Release
164+
- name: Upload latest.json to release
263165
uses: softprops/action-gh-release@v1
264166
with:
265-
draft: true
266-
files: |
267-
latest.json
268-
artifacts/macos-14-app/*.dmg
269-
artifacts/macos-14-app/*.app
270-
artifacts/windows-latest-app/*.msi
271-
artifacts/windows-latest-app/*.exe
167+
files: latest.json
272168
env:
273169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)