Skip to content

Commit

Permalink
feat(tauri): auto updater
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Nov 8, 2023
1 parent d17b63d commit dd1bf65
Show file tree
Hide file tree
Showing 24 changed files with 1,230 additions and 359 deletions.
84 changes: 72 additions & 12 deletions .github/workflows/build-tauri.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Test Build Tauri
name: Build Tauri

on:
push:
branches-ignore:
- "master"
paths-ignore:
- "website"
workflow_call:
workflow_dispatch:
jobs:
build:
name: "Test Build"
Expand All @@ -13,20 +19,38 @@ jobs:
include:
- os: ubuntu-22.04
name: linux
# https://tauri.app/v1/guides/building/linux#cross-compiling-tauri-applications-for-arm-based-devices
# Cross Compiling is also more of a pain it seems for linux atm, explore later
targets: "x86_64-unknown-linux-gnu"
tauri_target: ["x86_64-unknown-linux-gnu"]
- os: macos-latest
name: mac
targets: "aarch64-apple-darwin,x86_64-apple-darwin"
tauri_target: ["universal-apple-darwin"]
- os: windows-latest
name: win
targets: "aarch64-pc-windows-msvc,x86_64-pc-windows-msvc"
# The MSI installer is better integrated with the Add/Remove menu and feels more modern.
# The only real added benefit of NSIS is that the installer can have a custom logo.
# Also, nsis is the only one that currently works on arm64
# Another note is embedBootstrapper is enabled to improve support on window 7. Though windows 7 doesn't support arm64.
tauri_target: ["'aarch64-pc-windows-msvc --bundles nsis,updater'", "'x86_64-pc-windows-msvc --bundles msi,updater'"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
cache: "yarn"
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.targets }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './app/tauri -> target'
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04'
run: |
Expand All @@ -36,14 +60,50 @@ jobs:
run: |
yarn install --immutable --network-timeout 120000
- name: Build
run: yarn build:tauri
shell: bash
run: |
for target in ${{ join(matrix.tauri_target, ' ') }}; do
yarn build:tauri --target $target --config ./app/tauri/release.conf.json
done
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# Possibly set up some basic unit testing just to make sure parts render and none of the libraries are straight up breaking
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: tauri-${{ matrix.name }}
path: |
app/tauri/target/*/release/bundle/**/*.AppImage
app/tauri/target/*/release/bundle/**/*.dmg
app/tauri/target/*/release/bundle/**/*.deb
app/tauri/target/*/release/bundle/**/msi/*.msi
app/tauri/target/*/release/bundle/**/nsis/*.exe
app/tauri/target/*/release/bundle/appimage/**/*.tar.gz
app/tauri/target/*/release/bundle/macos/**/*.tar.gz
app/tauri/target/*/release/bundle/**/*.zip
app/tauri/target/*/release/bundle/**/*.sig
generate-updater-file:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Display structure of downloaded files
shell: bash
run: ls -R
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "yarn"
- name: Generate updater file
run: node app/tauri/release-prep/release-prep.js
- uses: actions/upload-artifact@v3
with:
name: built-app-${{ matrix.name }}
name: tauri-release
path: |
app/tauri/target/release/bundle/deb/*.deb
app/tauri/target/release/bundle/appimage/*.AppImage
app/tauri/target/release/bundle/msi/*.msi
app/tauri/target/release/bundle/dmg/*.dmg
app/tauri/target/release/bundle/macos/*.app
release/*
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,37 @@ jobs:
with:
name: built-app-all-in-one-${{ matrix.name }}
path: |
app/main/dist/Pomatez-v+([0-9]).+([0-9]).+([0-9])-win-*.exe
app/electron/dist/Pomatez-v+([0-9]).+([0-9]).+([0-9])-win-*.exe
- name: Upload ia32 builds
uses: actions/upload-artifact@v3
with:
name: built-app-ia32-${{ matrix.name }}
path: |
app/main/dist/Pomatez*ia32*.*
app/electron/dist/Pomatez*ia32*.*
- name: Upload x64 builds
uses: actions/upload-artifact@v3
with:
name: built-app-x64-${{ matrix.name }}
path: |
app/main/dist/Pomatez*x64*.*
app/main/dist/Pomatez*x86_64*.*
app/main/dist/Pomatez*amd64*.*
app/electron/dist/Pomatez*x64*.*
app/electron/dist/Pomatez*x86_64*.*
app/electron/dist/Pomatez*amd64*.*
- name: Upload arm64 builds
uses: actions/upload-artifact@v3
with:
name: built-app-arm64-${{ matrix.name }}
path: |
app/main/dist/Pomatez*arm64*.*
app/main/dist/Pomatez*aarch64*.*
app/electron/dist/Pomatez*arm64*.*
app/electron/dist/Pomatez*aarch64*.*
- name: Upload armv7l builds
uses: actions/upload-artifact@v3
with:
name: built-app-armv7l-${{ matrix.name }}
path: |
app/main/dist/Pomatez*armv7l*.*
app/electron/dist/Pomatez*armv7l*.*
- name: Upload autoupdaters
uses: actions/upload-artifact@v3
with:
name: built-app-AutoUpdater-${{ matrix.name }}
path: |
app/main/dist/latest*
app/electron/dist/latest*
32 changes: 19 additions & 13 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
sha: ${{ steps.release.outputs.sha }}
upload_url: ${{ steps.release.outputs.upload_url }}
build:
name: "Build"
build-node:
name: "Build Node"
needs: release-please
if: needs.release-please.outputs.release_created
uses: ./.github/workflows/build.yml
build-tauri:
name: "Build Tauri"
needs: release-please
if: needs.release-please.outputs.release_created
uses: ./.github/workflows/build-tauri.yml
publish:
name: Publish
needs:
- build
- build-node
- build-tauri
- release-please
runs-on: ubuntu-latest
steps:
Expand All @@ -42,15 +48,15 @@ jobs:
with:
tag_name: ${{ needs.release-please.outputs.tag }}
files: |
**/latest*
**/*.deb
**/*.rpm
**/*.dmg
**/*.AppImage
**/*.zip
**/*.exe
**/*.snap
**/*.blockmap
built-*/latest*
built-*/*.deb
built-*/*.rpm
built-*/*.dmg
built-*/*.AppImage
built-*/*.zip
built-*/*.exe
built-*/*.snap
built-*/*.blockmap
publish-to-homebrew-cask:
name: Publish to Homebrew Cask
needs:
Expand All @@ -75,4 +81,4 @@ jobs:
installers-regex: 'setup\.exe$'
max-versions-to-keep: 5 # keep only latest 5 versions
release-tag: ${{ needs.release-please.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/test-build-thingy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
push:
workflow_call:
workflow_dispatch:

permissions:
contents: write
pull-requests: write
jobs:
build-node:
name: "Build Node"
uses: ./.github/workflows/build.yml
build-tauri:
name: "Build Tauri"
uses: ./.github/workflows/build-tauri.yml
secrets: inherit
publish:
name: Publish
needs:
- build-node
- build-tauri
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
shell: bash
run: ls -R

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/dist
/build
/artifacts/

.DS_Store
.env.local
Expand All @@ -20,3 +21,4 @@ yarn-error.log*
.idea/
*.iml
/lerna-debug.log
/release/
8 changes: 4 additions & 4 deletions app/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
},
"dependencies": {
"@pomatez/shareables": "*",
"@tauri-apps/api": "2.0.0-alpha.8",
"@tauri-apps/plugin-autostart": "^2.0.0-alpha.1",
"@tauri-apps/plugin-global-shortcut": "^2.0.0-alpha.1",
"@tauri-apps/plugin-window": "^2.0.0-alpha.1",
"@tauri-apps/api": "2.0.0-alpha.11",
"@tauri-apps/plugin-autostart": "2.0.0-alpha.2",
"@tauri-apps/plugin-global-shortcut": "2.0.0-alpha.2",
"@tauri-apps/plugin-window": "2.0.0-alpha.1",
"@types/autosize": "^3.0.7",
"@types/jest": "^26.0.24",
"@types/node": "^14.18.63",
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/contexts/connectors/TauriConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { encodeSvg } from "../../utils";
import { TraySVG } from "../../components";
import { enable, disable } from "@tauri-apps/plugin-autostart";
import { invoke } from "@tauri-apps/api/tauri";
import { invoke } from "@tauri-apps/api/primitives";

export const TauriConnectorProvider: React.FC = ({ children }) => {
const settings: SettingTypes = useSelector(
Expand Down
1 change: 1 addition & 0 deletions app/renderer/src/extensions/window.extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare global {
options?: Electron.OpenExternalOptions
) => Promise<void>;
};
__TAURI__: {};
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/shareables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"prepare": "yarn build",
"start": "rollup -c -w",
"build": "rollup -c"
"build": "rollup -c",
"dev:renderer": "rollup -c"
}
}
Loading

0 comments on commit dd1bf65

Please sign in to comment.