fix: keep using cli output as fallback for assetNamePattern

This commit is contained in:
FabianLars
2025-07-05 22:26:55 +02:00
parent a24ef5a6c3
commit 0983b1755e
3 changed files with 25 additions and 23 deletions

View File

@@ -114,18 +114,18 @@ 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 | string | `[name]_v[version]_[platform]_[arch][ext]` |
| 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 |
## Outputs

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -81,17 +81,19 @@ export function renderNamePattern(
}
export function getAssetName(asset: Artifact, pattern?: string) {
const debugPattern = asset.mode === 'debug' ? '_[mode]' : '';
// In a future version we may want to unify the naming schemes. For now we keep using the cli output.
// const debugPattern = asset.mode === 'debug' ? '_[mode]' : '';
// const DEFAULT_PATTERN = `[name]_v[version]${debugPattern}_[platform]_[arch][ext]`;
// pattern = pattern || DEFAULT_PATTERN;
const DEFAULT_PATTERN = `[name]_v[version]${debugPattern}_[platform]_[arch][ext]`;
pattern = pattern || DEFAULT_PATTERN;
const filename = renderNamePattern(
pattern,
asset as unknown as Record<string, string>,
);
return filename;
if (pattern) {
return renderNamePattern(
pattern,
asset as unknown as Record<string, string>,
);
} else {
return basename(asset.path);
}
}
export function createArtifact({