Skip to content

Commit

Permalink
feat: Add support for RPM bundle artifacts (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlemasle authored Jan 18, 2024
1 parent f096af9 commit 37e9ece
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/rpm-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
action: 'patch'
---

Add support for RPM bundle artifacts, introduced in tauri-bundler@2.0.0-alpha.14
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function buildProject(
name: info.name,
version: info.version,
wixLanguage: info.wixLanguage,
rpmRelease: info.rpmRelease,
};

await runner.execTauriCommand(['build'], [...tauriArgs], root);
Expand Down Expand Up @@ -175,6 +176,14 @@ export async function buildProject(
: arch === 'aarch64'
? 'arm64'
: arch;
const rpmArch =
arch === 'x64' || arch === 'x86_64'
? 'x86_64'
: arch === 'x32' || arch === 'x86' || arch === 'i686'
? 'i386'
: arch === 'arm'
? 'armhfp'
: arch;
const appImageArch =
arch === 'x64' || arch === 'x86_64'
? 'amd64'
Expand All @@ -190,6 +199,13 @@ export async function buildProject(
),
arch: debianArch,
},
{
path: join(
artifactsPath,
`bundle/rpm/${fileAppName}-${app.version}-${app.rpmRelease}.${rpmArch}.rpm`,
),
arch: rpmArch,
},
{
path: join(
artifactsPath,
Expand Down
4 changes: 4 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface Info {
name: string;
version: string;
wixLanguage: string | string[] | { [language: string]: unknown };
rpmRelease: string;
}

export type TargetPlatform = 'android' | 'ios' | 'macos' | 'linux' | 'windows';
Expand All @@ -61,6 +62,9 @@ export interface TauriConfig {
tauri?: {
bundle?: {
identifier: string;
rpm?: {
release?: string;
};
windows?: {
wix?: {
language?: string | string[] | { [language: string]: unknown };
Expand Down
7 changes: 7 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const extensions = [
'.AppImage.tar.gz',
'.AppImage',
'.deb',
'.rpm',
'.msi.zip.sig',
'.msi.zip',
'.msi',
Expand Down Expand Up @@ -266,6 +267,7 @@ export function getInfo(
let version;
let wixLanguage: string | string[] | { [language: string]: unknown } =
'en-US';
let rpmRelease = '1';

const config = getConfig(tauriDir);
if (targetInfo) {
Expand Down Expand Up @@ -298,11 +300,16 @@ export function getInfo(
process.exit(1);
}

if (config.tauri?.bundle?.rpm?.release) {
rpmRelease = config.tauri?.bundle?.rpm?.release;
}

return {
tauriPath: tauriDir,
name,
version,
wixLanguage,
rpmRelease,
};
} else {
// This should not actually happen.
Expand Down

0 comments on commit 37e9ece

Please sign in to comment.