diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml index 4fb4ca9..3619471 100644 --- a/.github/workflows/pake-cli.yaml +++ b/.github/workflows/pake-cli.yaml @@ -51,7 +51,7 @@ on: options: - 'deb' - 'appimage' - - 'all' + - 'rpm' jobs: build: diff --git a/bin/README.md b/bin/README.md index 3b7f28a..23816a0 100644 --- a/bin/README.md +++ b/bin/README.md @@ -178,7 +178,7 @@ Package the application to support both Intel and M1 chips, exclusively for macO #### [targets] -Select the output package format for Linux. Options include `deb`, `appimage`, or `all`. If `all` is selected, both `deb` and `appimage` will be packaged. Default is `deb`. +Choose the output package format, supporting `deb`, `appimage`, `rpm`, This option is only applicable to Linux and defaults to `deb`. ```shell --targets diff --git a/bin/README_CN.md b/bin/README_CN.md index 0560639..97e0944 100644 --- a/bin/README_CN.md +++ b/bin/README_CN.md @@ -178,7 +178,7 @@ pake [url] [options] #### [targets] -选择输出的包格式,支持 `deb`、`appimage` 或 `all`,如果选择 `all`,则会同时打包 `deb` 和 `appimage`,此选项仅适用于 Linux,默认为 `deb`。 +选择输出的包格式,支持 `deb`、`appimage`、`rpm`,此选项仅适用于 Linux,默认为 `deb`。 ```shell --targets diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts index d059968..62e3525 100644 --- a/bin/builders/LinuxBuilder.ts +++ b/bin/builders/LinuxBuilder.ts @@ -7,17 +7,28 @@ export default class LinuxBuilder extends BaseBuilder { super(options); } - getFileName(): string { - const { name } = this.options; - const arch = process.arch === 'x64' ? 'amd64' : process.arch; - return `${name}_${tauriConfig.version}_${arch}`; + getFileName() { + const { name, targets } = this.options; + const version = tauriConfig.version; + + let arch = process.arch === 'x64' ? 'amd64' : process.arch; + if (arch === 'arm64' && (targets === 'rpm' || targets === 'appimage')) { + arch = 'aarch64'; + } + + // The RPM format uses different separators and version number formats + if (targets === 'rpm') { + return `${name}-${version}-1.${arch}`; + } + + return `${name}_${version}_${arch}`; } // Customize it, considering that there are all targets. async build(url: string) { - const targetTypes = ['deb', 'appimage']; + const targetTypes = ['deb', 'appimage', 'rpm']; for (const target of targetTypes) { - if (this.options.targets === target || this.options.targets === 'all') { + if (this.options.targets === target) { await this.buildAndCopy(url, target); } } diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts index 96f14f2..369dfa8 100644 --- a/bin/helpers/merge.ts +++ b/bin/helpers/merge.ts @@ -101,9 +101,9 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon // Processing targets are currently only open to Linux. if (platform === 'linux') { delete tauriConf.bundle.linux.deb.files; - const validTargets = ['all', 'deb', 'appimage', 'rpm']; + const validTargets = ['deb', 'appimage', 'rpm']; if (validTargets.includes(options.targets)) { - tauriConf.bundle.targets = options.targets === 'all' ? ['deb', 'appimage', 'rpm'] : [options.targets]; + tauriConf.bundle.targets = [options.targets]; } else { logger.warn(`✼ The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`); }