refactor!: remove includeDebug and includeRelease settings (#1170)

This commit is contained in:
Fabian-Lars
2025-11-13 16:57:56 +01:00
committed by GitHub
parent 7485c956ab
commit adb8bd38d1
12 changed files with 80 additions and 152 deletions

5
.changes/includedebug.md Normal file
View File

@@ -0,0 +1,5 @@
---
action: major
---
**Breaking Change**: Remove `includeRelease` and `includeDebug`. You can switch to debug builds via `args: --debug`. To upload release _and_ debug builds, run `tauri-action` twice, preferably in a job matrix for concurrent builds.

View File

@@ -14,15 +14,15 @@ jobs:
matrix:
include:
- platform: 'macos-latest'
args: '--verbose --target universal-apple-darwin'
args: '--verbose --target universal-apple-darwin --debug'
- platform: 'ubuntu-22.04'
args: '--verbose'
args: '--verbose --debug'
- platform: 'windows-latest'
args: '--verbose'
args: '--verbose --debug'
- platform: 'ubuntu-24.04-arm'
args: '--verbose'
args: '--verbose --debug'
- platform: 'windows-11-arm'
args: '--verbose'
args: '--verbose --debug'
runs-on: ${{ matrix.platform }}
steps:
@@ -76,8 +76,6 @@ jobs:
TAURI_SIGNING_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
with:
projectPath: ./.github/fixtures/example-with-tauri-v2
includeDebug: true
includeRelease: false
tagName: ${{ !github.event.pull_request.head.repo.fork && 'example-with-tauri-v__VERSION__' || '' }}
releaseName: 'Release example with preconfigured Tauri app v__VERSION__ for tauri-v2'
releaseBody: 'See the assets to download this version and install.'
@@ -100,8 +98,6 @@ jobs:
bundleIdentifier: com.tauri.actiontest
appName: example
appVersion: ../package.json # relative to tauri.conf.json
includeDebug: true
includeRelease: false
tagName: ${{ !github.event.pull_request.head.repo.fork && 'example-v__VERSION__' || '' }}
releaseName: 'Release example app v__VERSION__ for tauri-v2'
releaseBody: 'See the assets to download this version and install.'

View File

@@ -60,14 +60,12 @@ jobs:
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
- uses: tauri-apps/tauri-action@v0
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@@ -101,8 +99,6 @@ These inputs allow you to change how your Tauri project will be build.
| Name | Required | Description | Type | Default |
| -------------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------ |
| `projectPath` | false | The path to the root of the tauri project relative to the current working directory | string | . |
| `includeDebug` | false | whether to include a debug build or not | bool | false |
| `includeRelease` | false | whether to include a release build or not | bool | true |
| `includeUpdaterJson` | false | whether to upload a JSON file for the updater or not (only relevant if the updater is configured) | bool | true |
| `updaterJsonPreferNsis` | false | whether the action will use the NSIS (setup.exe) or WiX (.msi) bundles for the updater JSON if both types exist | bool | `false`. May be changed to `true` for projects using `tauri@v2` in the future. |
| `updaterJsonKeepUniversal` | false | whether the updater JSON file should include universal macOS builds as darwin-universal on top of using it in the aarch64 and x86_64 fields. | bool | false |
@@ -160,7 +156,7 @@ These inputs allow you to modify the GitHub release.
- If you only want to build the app without having the action upload any assets, for example if you want to only use [`actions/upload-artifact`](https://github.com/actions/upload-artifact), simply omit `tagName`, `releaseName` and `releaseId`.
- Only enable `uploadPlainBinary` if you are sure what you're doing since Tauri doesn't officially support a portable mode, especially on platforms other than Windows where standalone binaries for GUI applications basically do not exist.
- `assetNamePattern` offers a few variables that will be replaced automatically if encapsulated in `[]`. Currently available variables are: `[name]`, `[version]`, `[platform]`, `[arch]`, `[mode]`, `[setup]`, `[_setup]`, `[ext]`.
- `[mode]` will be replaced with `debug` or `release`, depending on `includeDebug` and `includeRelease`.
- `[mode]` will be replaced with `debug` or `release`, depending on the use of the `--debug` flag in `args`.
- `[setup]` will be replaced with `-setup` which can be used to differenciate between the NSIS installer and the binary from `uploadPlainBinary`. For all other bundle types it will be an empty string.
- `[_setup]` behaves like `[setup]` but with `_setup` instead of `-setup`.
- Gitea support is experimental. It was implemented and tested solely by the community.

View File

@@ -32,12 +32,6 @@ inputs:
description: 'The app name to inject when initializing the Tauri app. Required if the name is not set via the `--config` flag.'
appVersion:
description: 'The app version to inject when initializing the Tauri app. Required if the version is not set via the `--config` flag.'
includeDebug:
description: 'Whether to include a debug build or not'
default: 'false'
includeRelease:
description: 'Whether to include a release build or not'
default: 'true'
includeUpdaterJson:
description: 'Whether to upload a static JSON file for the updater using GitHub Releases as the CDN'
default: 'true'

42
dist/index.js vendored
View File

@@ -40057,11 +40057,10 @@ async function getRunner(root, tauriScript) {
async function buildProject(root, debug, buildOpts, initOpts, retryAttempts, uploadPlainBinary) {
async function buildProject(root, buildOpts, initOpts, retryAttempts, uploadPlainBinary) {
const runner = await getRunner(root, buildOpts.tauriScript);
const tauriArgs = debug
? ['--debug', ...(buildOpts.args ?? [])]
: (buildOpts.args ?? []);
const tauriArgs = buildOpts.args ?? [];
const debug = [...tauriArgs].findIndex((e) => e === '-d' || e === '--debug') >= 0;
const targetArgIdx = [...tauriArgs].findIndex((e) => e === '-t' || e === '--target');
const targetPath = targetArgIdx >= 0 ? [...tauriArgs][targetArgIdx + 1] : undefined;
const configArgIdx = [...tauriArgs].findIndex((e) => e === '-c' || e === '--config');
@@ -40709,9 +40708,6 @@ async function run() {
const iconPath = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput('iconPath');
const appName = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput('appName');
const appVersion = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput('appVersion');
// TODO for v1 (since we recommended v0 instead of v0.x so far): Remove includeRelease && includeDebug and automatically resolve the target dir. If users want both types, they should run the action twice.
const includeRelease = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput('includeRelease');
const includeDebug = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput('includeDebug');
const includeUpdaterJson = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput('includeUpdaterJson');
const updaterJsonKeepUniversal = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput('updaterJsonKeepUniversal');
const retryAttempts = parseInt(_actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput('retryAttempts') || '0', 10);
@@ -40752,15 +40748,8 @@ async function run() {
const targetPath = targetArgIdx >= 0 ? [...args][targetArgIdx + 1] : undefined;
const configArgIdx = [...args].findIndex((e) => e === '-c' || e === '--config');
const configArg = configArgIdx >= 0 ? [...args][configArgIdx + 1] : undefined;
const releaseArtifacts = [];
const debugArtifacts = [];
if (includeRelease) {
releaseArtifacts.push(...(await (0,_build__WEBPACK_IMPORTED_MODULE_7__/* .buildProject */ .a)(projectPath, false, buildOptions, initOptions, retryAttempts, uploadPlainBinary)));
}
if (includeDebug) {
debugArtifacts.push(...(await (0,_build__WEBPACK_IMPORTED_MODULE_7__/* .buildProject */ .a)(projectPath, true, buildOptions, initOptions, retryAttempts, uploadPlainBinary)));
}
const artifacts = releaseArtifacts.concat(debugArtifacts);
const artifacts = [];
artifacts.push(...(await (0,_build__WEBPACK_IMPORTED_MODULE_7__/* .buildProject */ .a)(projectPath, buildOptions, initOptions, retryAttempts, uploadPlainBinary)));
if (artifacts.length === 0) {
if (releaseId || tagName) {
throw new Error('No artifacts were found.');
@@ -40826,7 +40815,7 @@ async function run() {
if (releaseId) {
await (0,_upload_release_assets__WEBPACK_IMPORTED_MODULE_5__/* .uploadAssets */ .r)(owner, repo, releaseId, artifacts, retryAttempts, githubBaseUrl, isGitea, assetNamePattern);
if (includeUpdaterJson) {
await (0,_upload_version_json__WEBPACK_IMPORTED_MODULE_6__/* .uploadVersionJSON */ .Y)(owner, repo, info.version, body, tagName, releaseId, releaseArtifacts.length !== 0 ? releaseArtifacts : debugArtifacts, targetInfo, info.unzippedSigs, updaterJsonPreferNsis, updaterJsonKeepUniversal, retryAttempts, githubBaseUrl, isGitea, assetNamePattern);
await (0,_upload_version_json__WEBPACK_IMPORTED_MODULE_6__/* .uploadVersionJSON */ .Y)(owner, repo, info.version, body, tagName, releaseId, artifacts, targetInfo, info.unzippedSigs, updaterJsonPreferNsis, updaterJsonKeepUniversal, retryAttempts, githubBaseUrl, isGitea, assetNamePattern);
}
}
else {
@@ -50887,8 +50876,7 @@ function renderNamePattern(pattern, replacements) {
}
function getAssetName(asset, pattern) {
// TODO(v1): 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]`;
// const DEFAULT_PATTERN = `[name]_v[version]_[platform]_[arch][ext]`;
// pattern = pattern || DEFAULT_PATTERN;
if (asset.name === 'latest.json') {
return 'latest.json';
@@ -50897,29 +50885,19 @@ function getAssetName(asset, pattern) {
return renderNamePattern(pattern, asset);
}
else {
if (asset.mode !== 'debug' &&
asset.ext !== '.app.tar.gz' &&
if (asset.ext !== '.app.tar.gz' &&
asset.ext !== '.app.tar.gz.sig' &&
asset.name !== 'binary') {
// See TODO above, in most cases we keep the file name set by tauri's cli.
return (0,external_node_path_.basename)(asset.path);
}
const name = (0,external_node_path_.basename)(asset.path, asset.ext);
let arch = '';
let dbg = '';
const arch = '_' + asset.arch;
let platform = '';
if (asset.ext === '.app.tar.gz' ||
asset.ext === '.app.tar.gz.sig' ||
asset.name === 'binary') {
arch = '_' + asset.arch;
}
if (asset.mode === 'debug') {
dbg = '-debug';
}
if (asset.name === 'binary') {
platform = '_' + asset.platform;
}
return name + platform + arch + dbg + asset.ext;
return name + platform + arch + asset.ext;
}
}
function createArtifact({ path, name, debug, platform, arch, bundle, version, }) {

View File

@@ -1,4 +1,4 @@
name: "publish"
name: 'publish'
on:
push:
@@ -61,7 +61,7 @@ jobs:
echo "Certificate imported."
- name: build and publish
uses: tauri-apps/tauri-action@v0
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
@@ -73,8 +73,8 @@ jobs:
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "App v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}

View File

@@ -1,4 +1,4 @@
name: "publish"
name: 'publish'
on:
push:
@@ -16,14 +16,14 @@ jobs:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
@@ -44,20 +44,18 @@ jobs:
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
- uses: tauri-apps/tauri-action@v0
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "App v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}

View File

@@ -1,4 +1,4 @@
name: "publish"
name: 'publish'
on: pull_request
@@ -49,14 +49,14 @@ jobs:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
@@ -77,14 +77,12 @@ jobs:
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
- uses: tauri-apps/tauri-action@v0
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

View File

@@ -1,4 +1,4 @@
name: "test-on-pr"
name: 'test-on-pr'
on: [pull_request]
@@ -10,14 +10,14 @@ jobs:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
@@ -38,15 +38,13 @@ jobs:
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
# If tagName and releaseId are omitted tauri-action will only build the app and won't try to upload any assets.
- uses: tauri-apps/tauri-action@v0
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

View File

@@ -16,7 +16,6 @@ import type { Artifact, BuildOptions, InitOptions } from './types';
export async function buildProject(
root: string,
debug: boolean,
buildOpts: BuildOptions,
initOpts: InitOptions,
retryAttempts: number,
@@ -24,9 +23,10 @@ export async function buildProject(
): Promise<Artifact[]> {
const runner = await getRunner(root, buildOpts.tauriScript);
const tauriArgs = debug
? ['--debug', ...(buildOpts.args ?? [])]
: (buildOpts.args ?? []);
const tauriArgs = buildOpts.args ?? [];
const debug =
[...tauriArgs].findIndex((e) => e === '-d' || e === '--debug') >= 0;
const targetArgIdx = [...tauriArgs].findIndex(
(e) => e === '-t' || e === '--target',

View File

@@ -23,9 +23,6 @@ async function run(): Promise<void> {
const iconPath = core.getInput('iconPath');
const appName = core.getInput('appName');
const appVersion = core.getInput('appVersion');
// TODO for v1 (since we recommended v0 instead of v0.x so far): Remove includeRelease && includeDebug and automatically resolve the target dir. If users want both types, they should run the action twice.
const includeRelease = core.getBooleanInput('includeRelease');
const includeDebug = core.getBooleanInput('includeDebug');
const includeUpdaterJson = core.getBooleanInput('includeUpdaterJson');
const updaterJsonKeepUniversal = core.getBooleanInput(
'updaterJsonKeepUniversal',
@@ -82,34 +79,17 @@ async function run(): Promise<void> {
const configArg =
configArgIdx >= 0 ? [...args][configArgIdx + 1] : undefined;
const releaseArtifacts: Artifact[] = [];
const debugArtifacts: Artifact[] = [];
const artifacts: Artifact[] = [];
if (includeRelease) {
releaseArtifacts.push(
...(await buildProject(
projectPath,
false,
buildOptions,
initOptions,
retryAttempts,
uploadPlainBinary,
)),
);
}
if (includeDebug) {
debugArtifacts.push(
...(await buildProject(
projectPath,
true,
buildOptions,
initOptions,
retryAttempts,
uploadPlainBinary,
)),
);
}
const artifacts = releaseArtifacts.concat(debugArtifacts);
artifacts.push(
...(await buildProject(
projectPath,
buildOptions,
initOptions,
retryAttempts,
uploadPlainBinary,
)),
);
if (artifacts.length === 0) {
if (releaseId || tagName) {
@@ -219,7 +199,7 @@ async function run(): Promise<void> {
body,
tagName,
releaseId,
releaseArtifacts.length !== 0 ? releaseArtifacts : debugArtifacts,
artifacts,
targetInfo,
info.unzippedSigs,
updaterJsonPreferNsis,

View File

@@ -85,8 +85,7 @@ export function renderNamePattern(
export function getAssetName(asset: Artifact, pattern?: string) {
// TODO(v1): 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]`;
// const DEFAULT_PATTERN = `[name]_v[version]_[platform]_[arch][ext]`;
// pattern = pattern || DEFAULT_PATTERN;
if (asset.name === 'latest.json') {
@@ -100,7 +99,6 @@ export function getAssetName(asset: Artifact, pattern?: string) {
);
} else {
if (
asset.mode !== 'debug' &&
asset.ext !== '.app.tar.gz' &&
asset.ext !== '.app.tar.gz.sig' &&
asset.name !== 'binary'
@@ -110,27 +108,14 @@ export function getAssetName(asset: Artifact, pattern?: string) {
}
const name = basename(asset.path, asset.ext);
let arch = '';
let dbg = '';
const arch = '_' + asset.arch;
let platform = '';
if (
asset.ext === '.app.tar.gz' ||
asset.ext === '.app.tar.gz.sig' ||
asset.name === 'binary'
) {
arch = '_' + asset.arch;
}
if (asset.mode === 'debug') {
dbg = '-debug';
}
if (asset.name === 'binary') {
platform = '_' + asset.platform;
}
return name + platform + arch + dbg + asset.ext;
return name + platform + arch + asset.ext;
}
}