Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ inputs:
updaterJsonPreferNsis:
description: 'Whether the action will use the NSIS (setup.exe) or WiX (.msi) bundles for the updater JSON if both types exist. Will default to false. May default to true for apps using tauri@v2 in the future.'
default: 'false'
updaterJsonUseApiUrl:
description: 'Whether the updater JSON should use GitHub API download URLs (https://api.github.com/repos/OWNER/REPO/releases/assets/ASSET_ID) instead of browser download URLs. Useful for private repos where browser download URLs require authentication.'
default: 'false'
tauriScript:
description: 'The script to run to build the Tauri app'
args:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export const updaterJsonPreferNsis = core.getBooleanInput(
'updaterJsonPreferNsis',
);

export const updaterJsonUseApiUrl = core.getBooleanInput(
'updaterJsonUseApiUrl',
);

export const isAndroid = core.getInput('mobile').toLowerCase() === 'android';
export const isIOS = core.getInput('mobile').toLowerCase() === 'ios';
export const isDebug = parsedArgs.debug as boolean;
22 changes: 14 additions & 8 deletions src/upload-version-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
releaseAssetNamePattern,
repo,
updaterJsonPreferNsis,
updaterJsonUseApiUrl,
} from './inputs';
import { uploadAssets } from './upload-release-assets';
import {
Expand Down Expand Up @@ -124,7 +125,9 @@ export async function uploadVersionJSON(
downloadUrls.push({
name: data.name,
label: data.label,
url: data.browser_download_url,
url: updaterJsonUseApiUrl
? `${githubBaseUrl}/repos/${owner}/${repo}/releases/assets/${data.id}`
: data.browser_download_url,
});
}

Expand Down Expand Up @@ -233,13 +236,16 @@ export async function uploadVersionJSON(
continue;
}

// Untagged release downloads won't work after the release was published
updaterFileDownloadUrl = updaterFileDownloadUrl.replace(
/\/download\/(untagged-[^/]+)\//,
tagName
? `/download/${encodeURIComponent(tagName)}/`
: '/latest/download/',
);
// Untagged release downloads won't work after the release was published.
// API URLs don't need this transformation.
if (!updaterJsonUseApiUrl) {
updaterFileDownloadUrl = updaterFileDownloadUrl.replace(
/\/download\/(untagged-[^/]+)\//,
tagName
? `/download/${encodeURIComponent(tagName)}/`
: '/latest/download/',
);
}

let os = targetInfo.platform as string;
if (os === 'macos') {
Expand Down