feat: support --no-bundle arg, add the built bin (#1141)

Co-authored-by: Fabian-Lars <github@fabianlars.de>
This commit is contained in:
Jeromos Kovács
2025-10-01 14:21:51 +02:00
committed by GitHub
parent 69b3ce1e6c
commit 0085932c0f
7 changed files with 79 additions and 25 deletions

View File

@@ -0,0 +1,5 @@
---
action: patch
---
Added option to upload the app's binary alongside installers.

View File

@@ -114,18 +114,19 @@ These inputs allow you to change how your Tauri project will be build.
These inputs allow you to modify the GitHub release.
| Name | Required | Description | Type | Default |
| ------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------------- |
| `releaseId` | false | The id of the release to upload artifacts as release assets. If set, `tagName` and `releaseName` will not be considered to find a release. | number | |
| `tagName` | false | The tag name of the release to upload/create or the tag of the release belonging to `releaseId` | string | |
| `releaseName` | false | The name of the release to create. Required if there's no existing release for `tagName` | string | |
| `releaseBody` | false | The body of the release to create | string | |
| `releaseDraft` | false | Whether the release to find or create is a draft or not | bool | false |
| `prerelease` | false | Whether the release to create is a prerelease or not | bool | false |
| `releaseCommitish` | false | Any branch or commit SHA the Git tag is created from, unused if the Git tag already exists. | string | SHA of current commit |
| `owner` | false | The account owner of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | owner of the current repo |
| `repo` | false | The name of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | name of the current repo |
| `assetNamePattern` | false | The naming pattern to use for the uploaded assets. If not set, the names given by Tauri's CLI are kept. | string | none |
| Name | Required | Description | Type | Default |
| ------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------------- |
| `releaseId` | false | The id of the release to upload artifacts as release assets. If set, `tagName` and `releaseName` will not be considered to find a release. | number | |
| `tagName` | false | The tag name of the release to upload/create or the tag of the release belonging to `releaseId` | string | |
| `releaseName` | false | The name of the release to create. Required if there's no existing release for `tagName` | string | |
| `releaseBody` | false | The body of the release to create | string | |
| `releaseDraft` | false | Whether the release to find or create is a draft or not | bool | false |
| `prerelease` | false | Whether the release to create is a prerelease or not | bool | false |
| `releaseCommitish` | false | Any branch or commit SHA the Git tag is created from, unused if the Git tag already exists. | string | SHA of current commit |
| `owner` | false | The account owner of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | owner of the current repo |
| `repo` | false | The name of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | name of the current repo |
| `assetNamePattern` | false | The naming pattern to use for the uploaded assets. If not set, the names given by Tauri's CLI are kept. | string | none |
| `uploadPlainBinary` | false | Whether the release gets the plain executable binary which is not bundled or not. | bool | false |
## Outputs

View File

@@ -60,6 +60,9 @@ inputs:
description: 'The name of the repository'
assetNamePattern:
description: 'The naming pattern to use for the uploaded assets'
uploadPlainBinary:
description: 'Whether to upload the plain executable file to the GitHub Releases'
default: 'false'
outputs:
releaseId:
description: 'The ID of the created release'

20
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -20,6 +20,7 @@ export async function buildProject(
buildOpts: BuildOptions,
initOpts: InitOptions,
retryAttempts: number,
uploadPlainBinary: boolean,
): Promise<Artifact[]> {
const runner = await getRunner(root, buildOpts.tauriScript);
@@ -144,6 +145,18 @@ export async function buildProject(
version: app.version,
}),
];
if (uploadPlainBinary) {
artifacts.push(
createArtifact({
path: join(artifactsPath, `${app.name}`),
name: app.name,
debug,
platform: targetInfo.platform,
arch,
version: app.version,
}),
);
}
} else if (targetInfo.platform === 'windows') {
if (arch.startsWith('i')) {
arch = 'x86';
@@ -314,6 +327,18 @@ export async function buildProject(
version: app.version,
}),
);
if (uploadPlainBinary) {
artifacts.push(
createArtifact({
path: join(artifactsPath, `${app.name}.exe`),
name: app.name,
debug,
platform: targetInfo.platform,
arch,
version: app.version,
}),
);
}
artifacts = winArtifacts;
} else {
@@ -487,6 +512,18 @@ export async function buildProject(
}),
);
}
if (uploadPlainBinary) {
artifacts.push(
createArtifact({
path: join(artifactsPath, `${app.name}`),
name: app.name,
debug,
platform: targetInfo.platform,
arch: appImageArch,
version: app.version,
}),
);
}
}
console.log(

View File

@@ -34,6 +34,7 @@ async function run(): Promise<void> {
const args = stringArgv(core.getInput('args'));
const bundleIdentifier = core.getInput('bundleIdentifier');
const assetNamePattern = core.getInput('assetNamePattern');
const uploadPlainBinary = core.getBooleanInput('uploadPlainBinary');
let tagName = core.getInput('tagName').replace('refs/tags/', '');
let releaseId = Number(core.getInput('releaseId'));
@@ -85,6 +86,7 @@ async function run(): Promise<void> {
buildOptions,
initOptions,
retryAttempts,
uploadPlainBinary,
)),
);
}
@@ -96,6 +98,7 @@ async function run(): Promise<void> {
buildOptions,
initOptions,
retryAttempts,
uploadPlainBinary,
)),
);
}

View File

@@ -96,15 +96,20 @@ export function getAssetName(asset: Artifact, pattern?: string) {
let arch = '';
let dbg = '';
if (asset.ext === '.app.tar.gz' || asset.ext === '.app.tar.gz.sig') {
if (
(asset.ext === '.app.tar.gz' ||
asset.ext === '.app.tar.gz.sig' ||
asset.ext === '' ||
asset.ext === '.exe') &&
!name.includes(asset.arch)
) {
arch = '_' + asset.arch;
}
if (asset.mode === 'debug') {
dbg = '-debug';
}
return name + arch + dbg + asset.ext;
return name + '_' + asset.platform + arch + dbg + asset.ext;
}
}