Skip to content

Commit

Permalink
Fix tauri not building updater bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavenVolkoff committed Aug 17, 2024
1 parent b5a4a09 commit 0c8a984
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/actions/publish-artifacts/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/publish-artifacts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@actions/artifact": "^2.1.9",
"@actions/core": "^1.10.1",
"@actions/glob": "^0.4.0",
"@actions/glob": "^0.5.0",
"@actions/io": "^1.1.3"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
settings:
- host: macos-13
target: x86_64-apple-darwin
bundles: app,dmg
bundles: dmg
os: darwin
arch: x86_64
- host: macos-14
target: aarch64-apple-darwin
bundles: app,dmg
bundles: dmg
os: darwin
arch: aarch64
- host: windows-latest
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:

- name: Build
run: |
pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }},updater
pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
Expand Down
16 changes: 13 additions & 3 deletions apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"category": "Productivity",
"shortDescription": "Spacedrive",
"longDescription": "Cross-platform universal file explorer, powered by an open-source virtual distributed filesystem.",
"createUpdaterArtifacts": "v1Compatible",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand All @@ -66,7 +67,18 @@
"minimumSystemVersion": "10.15",
"exceptionDomain": null,
"entitlements": null,
"frameworks": ["../../.deps/Spacedrive.framework"]
"frameworks": ["../../.deps/Spacedrive.framework"],
"dmg": {
"background": "dmg-background.png",
"appPosition": {
"x": 190,
"y": 190
},
"applicationFolderPosition": {
"x": 470,
"y": 190
}
}
},
"windows": {
"certificateThumbprint": null,
Expand All @@ -84,8 +96,6 @@
},
"plugins": {
"updater": {
"active": true,
"dialog": false,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBMURCMkU5NEU3NDAyOEMKUldTTUFuUk82YklkK296dlkxUGkrTXhCT3ZMNFFVOWROcXNaS0RqWU1kMUdRV2tDdFdIS0Y3YUsK",
"endpoints": [
"https://spacedrive.com/api/releases/tauri/{{version}}/{{target}}/{{arch}}"
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions scripts/tauri.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ const __cleanup = /** @type {string[]} */ ([])
const cleanUp = () => Promise.all(__cleanup.map(file => fs.unlink(file).catch(() => {})))
process.on('SIGINT', cleanUp)

// Check if file/dir exists
const exists = (/** @type {string} */ path) =>
fs
.access(path, fs.constants.R_OK)
.then(() => true)
.catch(() => false)

// Export environment variables defined in cargo.toml
const cargoConfig = await fs
.readFile(path.resolve(__root, '.cargo', 'config.toml'), { encoding: 'binary' })
Expand Down Expand Up @@ -104,20 +97,6 @@ try {
env.GENERATE_SOURCEMAP = 'false'

__cleanup.push(...(await patchTauri(__root, nativeDeps, targets, bundles, args)))

if (process.platform === 'darwin') {
// Configure DMG background
env.BACKGROUND_FILE = path.resolve(desktopApp, 'src-tauri', 'dmg-background.png')
env.BACKGROUND_FILE_NAME = path.basename(env.BACKGROUND_FILE)
env.BACKGROUND_CLAUSE = `set background picture of opts to file ".background:${env.BACKGROUND_FILE_NAME}"`

if (!(await exists(env.BACKGROUND_FILE)))
console.warn(
`WARNING: DMG background file not found at ${env.BACKGROUND_FILE}`
)

break
}
}
}

Expand Down
9 changes: 2 additions & 7 deletions scripts/utils/patchTauri.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,12 @@ export async function patchTauri(root, nativeDeps, targets, bundles, args) {
.readFile(path.join(tauriRoot, 'tauri.conf.json'), 'utf-8')
.then(JSON.parse)

if (bundles.length === 0) {
const defaultBundles = tauriConfig?.bundle?.targets
if (Array.isArray(defaultBundles)) bundles.push(...defaultBundles)
if (bundles.length === 0) bundles.push('all')
}

switch (args[0]) {
case 'dev':
tauriPatch.build.features.push('devtools')
break
case 'build': {
if (tauriConfig?.plugins?.updater?.active) {
if (tauriConfig?.bundle?.createUpdaterArtifacts !== false) {
const pubKey = await tauriUpdaterKey(nativeDeps)
if (pubKey != null) tauriPatch.plugins.updater.pubkey = pubKey
}
Expand All @@ -111,6 +105,7 @@ export async function patchTauri(root, nativeDeps, targets, bundles, args) {
}

if (osType === 'Darwin') {
// arm64 support was added in macOS 11.0
const macOSArm64MinimumVersion = '11.0'

let macOSMinimumVersion = tauriConfig?.bundle?.macOS?.minimumSystemVersion
Expand Down

0 comments on commit 0c8a984

Please sign in to comment.