Skip to content

Commit 52d8e65

Browse files
committed
feat: enhance Tauri app with server checksum upload and JWT secret management
1 parent bfd064b commit 52d8e65

12 files changed

Lines changed: 313 additions & 162 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
mv app/client/build release/huntly-client
143143
cd release
144144
zip -r huntly-client-${{ steps.get_version.outputs.version-without-v }}.zip ./huntly-client/*
145+
sha256sum huntly-server.jar > huntly-server-${{ steps.get_version.outputs.version-without-v }}.jar.sha256
145146
146147
- name: Upload client-build to release
147148
id: upload-client-asset
@@ -163,4 +164,15 @@ jobs:
163164
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
164165
asset_path: release/huntly-server.jar
165166
asset_name: huntly-server-${{ steps.get_version.outputs.version-without-v }}.jar
166-
asset_content_type: application/java-archive
167+
asset_content_type: application/java-archive
168+
169+
- name: Upload server checksum to release
170+
id: upload-server-checksum-asset
171+
uses: actions/upload-release-asset@v1
172+
env:
173+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174+
with:
175+
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
176+
asset_path: release/huntly-server-${{ steps.get_version.outputs.version-without-v }}.jar.sha256
177+
asset_name: huntly-server-${{ steps.get_version.outputs.version-without-v }}.jar.sha256
178+
asset_content_type: text/plain

.github/workflows/tauri-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
import os
145145
146146
pubkey = os.environ.get("TAURI_UPDATER_PUBKEY", "")
147-
updater = {"active": False} if not pubkey else {"pubkey": pubkey}
147+
updater = {"active": False} if not pubkey else {"active": True, "pubkey": pubkey}
148148
config = {"plugins": {"updater": updater}}
149149
150150
print("TAURI_CONFIG<<EOF")

.github/workflows/tauri-release.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Create Release
4848
uses: ncipollo/release-action@v1
4949
with:
50-
draft: false
50+
draft: true
5151
name: Desktop ${{ steps.get_version.outputs.version }}
5252
tag: ${{ steps.get_version.outputs.tag_name }}
5353
body: "${{ steps.tag.outputs.message }}"
@@ -181,6 +181,44 @@ jobs:
181181
rm -rf jre11
182182
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
183183
184+
- name: Prepare macOS signing credentials
185+
if: matrix.platform == 'macos-14'
186+
run: |
187+
for name in APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD APPLE_SIGNING_IDENTITY APPLE_API_ISSUER APPLE_API_KEY APPLE_API_PRIVATE_KEY; do
188+
if [ -z "${!name}" ]; then
189+
echo "$name secret is required for macOS desktop releases"
190+
exit 1
191+
fi
192+
done
193+
key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY}.p8"
194+
printf '%s' "$APPLE_API_PRIVATE_KEY" > "$key_path"
195+
echo "APPLE_API_KEY_PATH=$key_path" >> "$GITHUB_ENV"
196+
env:
197+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
198+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
199+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
200+
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
201+
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
202+
APPLE_API_PRIVATE_KEY: ${{ secrets.APPLE_API_PRIVATE_KEY }}
203+
204+
- name: Import Windows signing certificate
205+
if: matrix.platform == 'windows-2022'
206+
shell: pwsh
207+
run: |
208+
if ([string]::IsNullOrWhiteSpace($env:WINDOWS_CERTIFICATE)) { throw "WINDOWS_CERTIFICATE secret is required for Windows desktop releases" }
209+
if ([string]::IsNullOrWhiteSpace($env:WINDOWS_CERTIFICATE_PASSWORD)) { throw "WINDOWS_CERTIFICATE_PASSWORD secret is required for Windows desktop releases" }
210+
if ([string]::IsNullOrWhiteSpace($env:WINDOWS_CERTIFICATE_THUMBPRINT)) { throw "WINDOWS_CERTIFICATE_THUMBPRINT secret is required for Windows desktop releases" }
211+
New-Item -ItemType Directory -Force -Path certificate | Out-Null
212+
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
213+
certutil -decode certificate/tempCert.txt certificate/certificate.pfx
214+
Remove-Item certificate/tempCert.txt
215+
$securePassword = ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText
216+
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password $securePassword | Out-Null
217+
env:
218+
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
219+
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
220+
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
221+
184222
- name: Prepare Tauri release config
185223
run: |
186224
python3 - <<'PY' >> "$GITHUB_ENV"
@@ -195,19 +233,45 @@ jobs:
195233
"version": os.environ["TAURI_VERSION"],
196234
"plugins": {
197235
"updater": {
236+
"active": True,
237+
"dialog": False,
198238
"pubkey": pubkey,
199239
"endpoints": [os.environ["TAURI_UPDATER_ENDPOINT"]],
200240
}
201241
},
202242
}
203243
244+
bundle = {}
245+
platform = os.environ["TAURI_BUILD_PLATFORM"]
246+
if platform == "macos-14":
247+
signing_identity = os.environ.get("APPLE_SIGNING_IDENTITY", "")
248+
if not signing_identity:
249+
raise SystemExit("APPLE_SIGNING_IDENTITY secret is required for macOS desktop releases")
250+
bundle["macOS"] = {"signingIdentity": signing_identity}
251+
elif platform == "windows-2022":
252+
certificate_thumbprint = os.environ.get("WINDOWS_CERTIFICATE_THUMBPRINT", "")
253+
if not certificate_thumbprint:
254+
raise SystemExit("WINDOWS_CERTIFICATE_THUMBPRINT secret is required for Windows desktop releases")
255+
bundle["windows"] = {
256+
"certificateThumbprint": certificate_thumbprint,
257+
"digestAlgorithm": "sha256",
258+
"timestampUrl": os.environ.get("WINDOWS_TIMESTAMP_URL") or "http://timestamp.digicert.com",
259+
}
260+
261+
if bundle:
262+
config["bundle"] = bundle
263+
204264
print("TAURI_CONFIG<<EOF")
205265
print(json.dumps(config))
206266
print("EOF")
207267
PY
208268
env:
209269
TAURI_VERSION: ${{ needs.create-release.outputs.version }}
270+
TAURI_BUILD_PLATFORM: ${{ matrix.platform }}
210271
TAURI_UPDATER_PUBKEY: ${{ secrets[format('TAURI_{0}', 'UPDATER_PUBKEY')] }}
272+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
273+
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
274+
WINDOWS_TIMESTAMP_URL: ${{ secrets.WINDOWS_TIMESTAMP_URL }}
211275

212276
- name: Build the app
213277
run: |
@@ -216,6 +280,11 @@ jobs:
216280
env:
217281
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets[format('TAURI_{0}', 'SIGNING_PRIVATE_KEY')] }}
218282
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets[format('TAURI_{0}', 'SIGNING_PRIVATE_KEY_PASSWORD')] }}
283+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
284+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
285+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
286+
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
287+
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
219288

220289
- name: Collect release artifacts
221290
run: |
@@ -315,4 +384,11 @@ jobs:
315384
fi
316385
env:
317386
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
318-
GH_REPO: ${{ github.repository }}
387+
GH_REPO: ${{ github.repository }}
388+
389+
- name: Publish desktop release
390+
run: gh release edit "$TAG_NAME" --draft=false
391+
env:
392+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
393+
GH_REPO: ${{ github.repository }}
394+
TAG_NAME: ${{ needs.create-release.outputs.tag_name }}

app/tauri/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"@tauri-apps/api": "^2.0.0",
2323
"@tauri-apps/plugin-autostart": "^2.0.0",
2424
"@tauri-apps/plugin-dialog": "^2.0.0",
25-
"@tauri-apps/plugin-fs": "^2.0.0",
2625
"@tauri-apps/plugin-updater": "^2.0.0",
2726
"@tauri-apps/plugin-shell": "^2.0.0",
2827
"@tauri-apps/plugin-store": "^2.4.1",

app/tauri/src-tauri/Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/tauri/src-tauri/Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "huntly-app"
3-
version = "0.0.0"
4-
description = "A Tauri App"
5-
authors = ["you"]
6-
license = ""
7-
repository = ""
3+
version = "0.1.0"
4+
description = "Huntly desktop app"
5+
authors = ["lcomplete"]
6+
license = "Apache-2.0"
7+
repository = "https://github.com/lcomplete/huntly"
88
edition = "2021"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -21,14 +21,15 @@ embed-resource = "2.1"
2121
tauri = { version = "2", features = ["tray-icon"] }
2222
tauri-plugin-autostart = "2"
2323
tauri-plugin-shell = "2"
24-
tauri-plugin-fs = "2"
2524
tauri-plugin-dialog = "2"
2625
tauri-plugin-updater = "2.0.0"
2726
serde = { version = "1.0", features = ["derive"] }
2827
reqwest = { version = "0.11.16", features = ["json", "cookies"] }
2928
serde_json = "1.0"
3029
lazy_static = "1.4"
3130
zip = "7.0.0"
31+
sha2 = "0.10"
32+
getrandom = "0.2"
3233

3334
[target.'cfg(target_os = "macos")'.dependencies]
3435
objc2 = "0.6.3"

app/tauri/src-tauri/capabilities/default.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,6 @@
88
"updater:default",
99
"shell:allow-open",
1010
"autostart:default",
11-
"fs:default",
12-
{
13-
"identifier": "fs:allow-read",
14-
"allow": [{"path": "$APPDATA/**"}, {"path": "$HOME/**"}]
15-
},
16-
{
17-
"identifier": "fs:allow-write",
18-
"allow": [{"path": "$APPDATA/**"}, {"path": "$HOME/**"}]
19-
},
20-
{
21-
"identifier": "fs:allow-exists",
22-
"allow": [{"path": "$APPDATA/**"}, {"path": "$HOME/**"}]
23-
},
24-
"fs:allow-mkdir",
2511
"dialog:default",
2612
"dialog:allow-open"
2713
]

0 commit comments

Comments
 (0)