11name : huntly tauri build workflow
22
33on :
4- # This line enables manual triggering of this workflow.
54 workflow_dispatch :
65
6+ permissions :
7+ contents : read
8+
9+ env :
10+ NODE_VERSION : " 20.10.0"
11+ YARN_VERSION : " 1.22.19"
12+ JDK_VERSION : " 11"
13+
714jobs :
815 build-server-jar :
916 runs-on : ubuntu-latest
1017 steps :
1118 - name : Checkout repository
12- uses : actions/checkout@v3
19+ uses : actions/checkout@v4
1320
1421 - name : Set Node.js (client)
15- uses : actions/setup-node@v3
22+ uses : actions/setup-node@v4
1623 with :
17- node-version : " 20.10.0 "
24+ node-version : ${{ env.NODE_VERSION }}
1825 cache : " yarn"
1926 cache-dependency-path : " app/client/yarn.lock"
2027
2128 - name : Setup yarn
22- run : npm install -g yarn --version 1.22.19
29+ run : npm install -g yarn@${{ env.YARN_VERSION }}
2330
2431 - name : Build client
2532 run : |
2633 cd app/client
2734 yarn install --frozen-lockfile
2835 yarn build
36+ env :
37+ CI : false
2938
30- - name : Set up JDK 11
31- uses : actions/setup-java@v3
39+ - name : Set up JDK
40+ uses : actions/setup-java@v4
3241 with :
33- java-version : " 11 "
42+ java-version : ${{ env.JDK_VERSION }}
3443 distribution : " temurin"
3544
3645 - name : Cache maven dependencies
37- uses : actions/cache@v3
46+ uses : actions/cache@v4
3847 env :
3948 cache-name : cache-maven-dependencies
4049 with :
@@ -45,19 +54,18 @@ jobs:
4554 - name : Build server jar
4655 run : |
4756 cd app/server
48- mvn -B clean package
57+ ./mvnw -B clean package
4958 env :
5059 CI : false
5160
5261 - name : Upload server jar artifact
5362 uses : actions/upload-artifact@v4
5463 with :
5564 name : huntly-server-jar
56- path : app/server/huntly-server/target/huntly-*.jar
65+ path : app/server/huntly-server/target/huntly-server-*.jar
66+ if-no-files-found : error
5767
5868 tauri-build :
59- permissions :
60- contents : write
6169 needs : build-server-jar
6270 strategy :
6371 fail-fast : false
@@ -66,15 +74,15 @@ jobs:
6674 - platform : macos-14
6775 tauri_target : aarch64-apple-darwin
6876 - platform : windows-2022
69- tauri_target : i686 -pc-windows-msvc
77+ tauri_target : x86_64 -pc-windows-msvc
7078 runs-on : ${{ matrix.platform }}
7179 defaults :
7280 run :
7381 shell : bash
7482
7583 steps :
7684 - name : Checkout repository
77- uses : actions/checkout@v3
85+ uses : actions/checkout@v4
7886
7987 - name : Rust setup
8088 uses : dtolnay/rust-toolchain@stable
@@ -88,24 +96,24 @@ jobs:
8896 run : rustup target add ${{ matrix.tauri_target }}
8997
9098 - name : Set Node.js (tauri)
91- uses : actions/setup-node@v3
99+ uses : actions/setup-node@v4
92100 with :
93- node-version : " 20.10.0 "
101+ node-version : ${{ env.NODE_VERSION }}
94102 cache : " yarn"
95103 cache-dependency-path : " app/tauri/yarn.lock"
96104
97105 - name : Setup yarn
98- run : npm install -g yarn --version 1.22.19
106+ run : npm install -g yarn@${{ env.YARN_VERSION }}
99107
100108 - name : Install tauri dependencies
101109 run : |
102110 cd app/tauri
103111 yarn install --frozen-lockfile
104112
105- - name : Set up JDK 11
106- uses : actions/setup-java@v3
113+ - name : Set up JDK
114+ uses : actions/setup-java@v4
107115 with :
108- java-version : " 11 "
116+ java-version : ${{ env.JDK_VERSION }}
109117 distribution : " temurin"
110118
111119 - name : Download server jar
@@ -114,22 +122,46 @@ jobs:
114122 name : huntly-server-jar
115123 path : app/tauri/src-tauri/server_bin
116124
117- - name : Move to server_bin
125+ - name : Move server jar into bundle resources
126+ run : |
127+ jar_path=$(find app/tauri/src-tauri/server_bin -name 'huntly-server-*.jar' -not -name '*.original' | head -n 1)
128+ if [ -z "$jar_path" ]; then
129+ echo "No huntly-server jar found"
130+ exit 1
131+ fi
132+ mv "$jar_path" app/tauri/src-tauri/server_bin/huntly-server.jar
133+
134+ - name : Build embedded JRE
118135 run : |
119- mv app/tauri/src-tauri/server_bin/huntly-*.jar app/tauri/src-tauri/server_bin/huntly-server.jar
136+ cd app/tauri/src-tauri/server_bin
137+ rm -rf jre11
138+ jlink --module-path "$JAVA_HOME/jmods" --add-modules java.compiler,java.sql,java.naming,java.management,java.instrument,java.rmi,java.desktop,jdk.internal.vm.compiler.management,java.xml.crypto,java.scripting,java.security.jgss,jdk.httpserver,java.net.http,jdk.naming.dns,jdk.crypto.cryptoki,jdk.unsupported --strip-debug --compress 2 --no-header-files --no-man-pages --output jre11
120139
121- - name : jlink
140+ - name : Prepare Tauri config
122141 run : |
123- cd app/tauri/src-tauri/server_bin/
124- jlink --module-path $JAVA_HOME/jmods --add-modules java.compiler,java.sql,java.naming,java.management,java.instrument,java.rmi,java.desktop,jdk.internal.vm.compiler.management,java.xml.crypto,java.scripting,java.security.jgss,jdk.httpserver,java.net.http,jdk.naming.dns,jdk.crypto.cryptoki,jdk.unsupported --verbose --strip-debug --compress 2 --no-header-files --no-man-pages --output jre11
142+ python3 - <<'PY' >> "$GITHUB_ENV"
143+ import json
144+ import os
145+
146+ pubkey = os.environ.get("TAURI_UPDATER_PUBKEY", "")
147+ updater = {"active": False} if not pubkey else {"pubkey": pubkey}
148+ config = {"plugins": {"updater": updater}}
149+
150+ print("TAURI_CONFIG<<EOF")
151+ print(json.dumps(config))
152+ print("EOF")
153+ PY
154+ env :
155+ TAURI_UPDATER_PUBKEY : ${{ secrets[format('TAURI_{0}', 'UPDATER_PUBKEY')] }}
125156
126157 - name : Build the app
127158 run : |
128159 cd app/tauri
129- yarn tauri build --target ${{ matrix.tauri_target }}
160+ yarn tauri: build --target ${{ matrix.tauri_target }}
130161
131162 - name : Upload the build artifact
132163 uses : actions/upload-artifact@v4
133164 with :
134165 name : tauri-build-${{ matrix.platform }}
135166 path : app/tauri/src-tauri/target/${{ matrix.tauri_target }}/release/bundle
167+ if-no-files-found : error
0 commit comments