From ea72c4a85b87effd8ef1ca77de193d689d50b3ca Mon Sep 17 00:00:00 2001 From: Mikael Kristiansson Date: Tue, 3 Sep 2024 09:11:50 +0200 Subject: [PATCH] fix: add updater (#23) --- .github/workflows/publish.yml | 60 ++++++++++++++++++++--------------- .github/workflows/test.yml | 46 +++++++++++++++------------ package.json | 6 ++-- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 21 +++++------- 5 files changed, 72 insertions(+), 63 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42317bc..3739612 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,13 @@ -name: "Publish" +name: 'Publish' on: push: branches: - main +env: + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + jobs: publish-tauri: strategy: @@ -13,28 +17,32 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 - - name: setup node - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf - - name: install app dependencies and build it - run: yarn && yarn tauri:build - - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tagName: gitbar-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version - releaseName: Gitbar v__VERSION__ - releaseBody: "" - releaseDraft: true - prerelease: false + - uses: actions/checkout@v4 + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: install Rust stable + uses: actions-rs/toolchain@stable + with: + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + - name: install app dependencies and build it + run: yarn && yarn tauri:build + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + with: + tagName: gitbar-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version + releaseName: Gitbar v__VERSION__ + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: false + args: ${{ matrix.args }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47fa512..f2ab990 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,10 @@ -name: "test-on-pr" +name: 'test-on-pr' on: [pull_request] +env: + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + jobs: test-tauri: strategy: @@ -10,22 +14,24 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 - - name: setup node - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf - - name: install app dependencies and build it - run: yarn && yarn tauri:build - - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: setup node + uses: actions/setup-node@v1 + with: + node-version: 16 + - name: install Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + - name: install app dependencies and build it + run: yarn && yarn tauri:build + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} diff --git a/package.json b/package.json index 18c810a..04bc8a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gitbar", "private": true, - "version": "0.4.2", + "version": "0.4.3", "type": "module", "scripts": { "dev": "vite", @@ -29,11 +29,11 @@ "vite": "^3.0.9" }, "prettier": { - "tabWidth": 4, + "tabWidth": 2, "trailingComma": "es5", "semi": true, "singleQuote": true, "printWidth": 120, "arrowParens": "avoid" } -} \ No newline at end of file +} diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fa5a004..6ebefec 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gitbar" -version = "0.4.2" +version = "0.4.3" description = "Github review counter" authors = ["mikael.kristiansson"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3987885..a8bade4 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,15 +8,13 @@ }, "package": { "productName": "GitBar", - "version": "0.4.2" + "version": "0.4.3" }, "tauri": { "allowlist": { "http": { "request": true, - "scope": [ - "https://**" - ] + "scope": ["https://**"] }, "notification": { "all": true @@ -33,13 +31,7 @@ "depends": [] }, "externalBin": [], - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ], + "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"], "identifier": "com.gitbar.dev", "longDescription": "Github reviews in your system taskbar", "macOS": { @@ -62,7 +54,10 @@ "csp": null }, "updater": { - "active": false + "active": true, + "endpoints": ["https://gitbar-update-server.vercel.app/update/{{target}}/{{current_version}}"], + "dialog": true, + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEYxMTYzNDYzNzU1QzYxQkIKUldTN1lWeDFZelFXOFJBZlp3OFZYWFZvK2c3RU5xSGZwVE45ciswWGpwRUdTRXBJbzFnMmRZZlgK" }, "systemTray": { "iconPath": "icons/tray.png", @@ -83,4 +78,4 @@ } ] } -} \ No newline at end of file +}