From 93752106cf115fc6ffb1b62f5de34d05e2ec9970 Mon Sep 17 00:00:00 2001 From: Jeroen Nijhuis Date: Mon, 22 Apr 2024 20:51:33 +0200 Subject: [PATCH] feat: enable auto-updater --- .github/workflows/build.yml | 9 ++++++--- .github/workflows/release.yml | 15 ++++++++++----- src-tauri/tauri.conf.json | 19 ++++++++++++++++--- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfce1cf..55088a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: branches: ["main"] types: - completed - + concurrency: group: build-${{ github.ref }} cancel-in-progress: true @@ -27,8 +27,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - cache: 'npm' - + cache: "npm" + - name: Install dependencies run: npm install @@ -54,12 +54,15 @@ jobs: - name: Build Vite + Tauri (MacOS + Linux) if: matrix.platform != 'windows-latest' + env: + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} run: | npm run build - name: Build Vite + Tauri (Windows) if: matrix.platform == 'windows-latest' env: + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} OPENSSL_DIR: 'C:\Program Files\OpenSSL' SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem' OPENSSL_NO_VENDOR: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31db495..c8b11f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - cache: 'npm' + cache: "npm" - name: Install dependencies run: npm install @@ -51,6 +51,8 @@ jobs: - name: Build Vite + Tauri (MacOS + Linux) if: matrix.platform != 'windows-latest' + env: + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} run: npm run build - name: Build Vite + Tauri (Windows) @@ -59,6 +61,7 @@ jobs: OPENSSL_DIR: 'C:\Program Files\OpenSSL' SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem' OPENSSL_NO_VENDOR: 1 + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} run: npm run build - name: Create release (MacOS + Linux) @@ -66,10 +69,11 @@ jobs: uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} with: tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version - releaseName: 'v__VERSION__' - releaseBody: 'See the assets to download and install this version.' + releaseName: "v__VERSION__" + releaseBody: "See the assets to download and install this version." releaseDraft: true prerelease: false tauriScript: ./node_modules/.bin/tauri @@ -82,10 +86,11 @@ jobs: SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem' OPENSSL_NO_VENDOR: 1 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} with: tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version - releaseName: 'v__VERSION__' - releaseBody: 'See the assets to download and install this version.' + releaseName: "v__VERSION__" + releaseBody: "See the assets to download and install this version." releaseDraft: true prerelease: false tauriScript: ./node_modules/.bin/tauri diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 76adb3b..5645bb2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -10,12 +10,25 @@ "beforeBuildCommand": "npm run vite:build" }, "tauri": { + "updater": { + "active": true, + "endpoints": ["https://www.jet-pilot.app/latest.json"], + "dialog": true, + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDVDNUVCM0NBRDZFNzFFOEIKUldTTEh1Zld5ck5lWEx6MEdwZXp4cHBReDR6dUtac3pNUm9GbUxvcFhKS28wOTJQL1BqNkFiN2EK" + }, "macOSPrivateApi": true, "allowlist": { "all": true, "fs": { - "all": true, - "scope": ["$APPCONFIG/", "$APPCONFIG/*", "$TEMP/", "$TEMP/*", "$TEMP/*/**", "$TEMP/**"] + "all": true, + "scope": [ + "$APPCONFIG/", + "$APPCONFIG/*", + "$TEMP/", + "$TEMP/*", + "$TEMP/*/**", + "$TEMP/**" + ] }, "shell": { "scope": [ @@ -55,4 +68,4 @@ "csp": null } } -} \ No newline at end of file +}