Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change msi naming scheme for recent Tauri upgrades #227

Merged
merged 7 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/tauri-lang-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tauri-apps/action-core": minor
"action": minor
---

Update to Tauri release candidate.
6 changes: 3 additions & 3 deletions packages/action/dist/index.js

Large diffs are not rendered by default.

55 changes: 43 additions & 12 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,22 @@ interface TauriConfig {
productName?: string
version?: string
}
tauri?: {
bundle?: {
windows?: {
wix?: {
language?: string | string[] | { [language: string]: unknown }
}
}
}
}
}

interface Application {
runner: Runner
name: string
version: string
wixLanguage: string | string[] | { [language: string]: unknown }
}

export interface BuildOptions {
Expand All @@ -126,12 +136,14 @@ export interface Runner {
interface Info {
name: string
version: string
wixLanguage: string | string[] | { [language: string]: unknown }
}
export function getInfo(root: string): Info {
const configPath = join(root, 'src-tauri/tauri.conf.json')
if (existsSync(configPath)) {
let name
let version
let wixLanguage: string | string[] | { [language: string]: unknown } = 'en-US'
const config = JSON.parse(
readFileSync(configPath).toString()
) as TauriConfig
Expand All @@ -147,6 +159,9 @@ export function getInfo(root: string): Info {
name = name || cargoManifest.package.name
version = version || cargoManifest.package.version
}
if (config.tauri?.bundle?.windows?.wix?.language) {
wixLanguage = config.tauri.bundle.windows.wix.language
}

if (!(name && version)) {
console.error('Could not determine package name and version')
Expand All @@ -156,6 +171,7 @@ export function getInfo(root: string): Info {
return {
name,
version,
wixLanguage,
}
} else {
const packageJson = getPackageJson(root)
Expand All @@ -165,7 +181,8 @@ export function getInfo(root: string): Info {
const version = packageJson ? packageJson.version : '0.1.0'
return {
name: appName,
version
version,
wixLanguage: 'en-US',
}
}
}
Expand Down Expand Up @@ -200,6 +217,7 @@ export async function buildProject(
runner,
name: info.name,
version: info.version,
wixLanguage: info.wixLanguage
}
} else {
const packageJson = getPackageJson(root)
Expand Down Expand Up @@ -230,6 +248,7 @@ export async function buildProject(
runner,
name: info.name,
version: info.version,
wixLanguage: info.wixLanguage,
}
if (iconPath) {
return execCommand(runner.runnerCommand, [...runner.runnerArgs, 'icon', join(root, iconPath)], {
Expand Down Expand Up @@ -309,20 +328,32 @@ export async function buildProject(
)
]
} else if (platform() === 'win32') {
return [
join(
// If multiple Wix languages are specified, multiple installers (.msi) will be made
// The .zip and .sig are only generated for the first specified language
let langs
if (typeof app.wixLanguage === "string") {
langs = [app.wixLanguage]
} else if (Array.isArray(app.wixLanguage)) {
langs = app.wixLanguage
} else {
langs = Object.keys(app.wixLanguage)
}
const artifacts: string[] = []
langs.forEach(lang => {
artifacts.push(join(
artifactsPath,
`bundle/msi/${fileAppName}_${app.version}_${process.arch}.msi`
),
join(
`bundle/msi/${fileAppName}_${app.version}_${process.arch}_${lang}.msi`
))
artifacts.push(join(
artifactsPath,
`bundle/msi/${fileAppName}_${app.version}_${process.arch}.msi.zip`
),
join(
`bundle/msi/${fileAppName}_${app.version}_${process.arch}_${lang}.msi.zip`
))
artifacts.push(join(
artifactsPath,
`bundle/msi/${fileAppName}_${app.version}_${process.arch}.msi.zip.sig`
)
]
`bundle/msi/${fileAppName}_${app.version}_${process.arch}_${lang}.msi.zip.sig`
))
})
return artifacts
} else {
const arch =
process.arch === 'x64'
Expand Down