Fix release workflow (#2668)

* Fix frontend bundle upload
 - Update pnpm

* Revert incorrect removal of fontenf packaging job

* Fix tauri not building updater bundles

* Ensure release action is executed when PRs modify the publish-artifacts action

* Fix unused argument for patchTauri function

* Couple for format fixes

* tauri requires building the app bundle to build the updater
This commit is contained in:
Vítor Vasconcellos
2024-08-17 08:29:32 +00:00
committed by GitHub
parent f2f39a2a46
commit 287a809de0
14 changed files with 116 additions and 83 deletions

View File

@@ -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' })
@@ -82,7 +75,7 @@ if (process.platform === 'linux' && (args[0] === 'dev' || args[0] === 'build'))
try {
switch (args[0]) {
case 'dev': {
__cleanup.push(...(await patchTauri(__root, nativeDeps, targets, bundles, args)))
__cleanup.push(...(await patchTauri(__root, nativeDeps, targets, args)))
switch (process.platform) {
case 'linux':
@@ -103,21 +96,7 @@ 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
}
__cleanup.push(...(await patchTauri(__root, nativeDeps, targets, args)))
}
}

View File

@@ -53,11 +53,10 @@ export async function tauriUpdaterKey(nativeDeps) {
* @param {string} root
* @param {string} nativeDeps
* @param {string[]} targets
* @param {string[]} bundles
* @param {string[]} args
* @returns {Promise<string[]>}
*/
export async function patchTauri(root, nativeDeps, targets, bundles, args) {
export async function patchTauri(root, nativeDeps, targets, args) {
if (args.findIndex(e => e === '-c' || e === '--config') !== -1) {
throw new Error('Custom tauri build config is not supported.')
}
@@ -91,18 +90,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
}
@@ -111,6 +104,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