mirror of
https://github.com/unraid/api.git
synced 2026-05-02 13:12:01 -05:00
build: replace hash with build increment in slackware txz pkg (#1449)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced support for specifying and propagating a build number throughout the build process, including command-line options and workflow inputs. * TXZ package naming and URLs now include the build number for improved traceability. * **Improvements** * Enhanced robustness in locating TXZ files with improved fallback logic, especially in CI environments. * Improved flexibility and validation of environment schema for plugin builds. * **Style** * Minor formatting corrections for consistency and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1210677942019563
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import { getTxzName, LOCAL_BUILD_TAG, pluginNameWithExt, defaultArch, defaultBuild } from "./consts";
|
||||
import {
|
||||
getTxzName,
|
||||
LOCAL_BUILD_TAG,
|
||||
pluginNameWithExt,
|
||||
defaultArch,
|
||||
defaultBuild,
|
||||
TxzNameParams,
|
||||
} from "./consts";
|
||||
|
||||
// Define a common interface for URL parameters
|
||||
interface UrlParams {
|
||||
@@ -6,9 +13,7 @@ interface UrlParams {
|
||||
tag?: string;
|
||||
}
|
||||
|
||||
interface TxzUrlParams extends UrlParams {
|
||||
apiVersion: string;
|
||||
}
|
||||
interface TxzUrlParams extends UrlParams, TxzNameParams {}
|
||||
|
||||
/**
|
||||
* Get the bucket path for the given tag
|
||||
@@ -47,4 +52,4 @@ export const getPluginUrl = (params: UrlParams): string =>
|
||||
* ex. returns = BASE_URL/TAG/dynamix.unraid.net-4.1.3-x86_64-1.txz
|
||||
*/
|
||||
export const getMainTxzUrl = (params: TxzUrlParams): string =>
|
||||
getAssetUrl(params, getTxzName(params.apiVersion, defaultArch, defaultBuild));
|
||||
getAssetUrl(params, getTxzName(params));
|
||||
|
||||
@@ -5,9 +5,21 @@ export const pluginNameWithExt = `${pluginName}.plg` as const;
|
||||
export const defaultArch = "x86_64" as const;
|
||||
export const defaultBuild = "1" as const;
|
||||
|
||||
export interface TxzNameParams {
|
||||
version?: string;
|
||||
arch?: string;
|
||||
build?: string;
|
||||
}
|
||||
|
||||
// Get the txz name following Slackware naming convention: name-version-arch-build.txz
|
||||
export const getTxzName = (version?: string, arch: string = defaultArch, build: string = defaultBuild) =>
|
||||
version ? `${pluginName}-${version}-${arch}-${build}.txz` : `${pluginName}.txz`;
|
||||
export const getTxzName = ({
|
||||
version,
|
||||
arch = defaultArch,
|
||||
build = defaultBuild,
|
||||
}: TxzNameParams) =>
|
||||
version
|
||||
? `${pluginName}-${version}-${arch}-${build}.txz`
|
||||
: `${pluginName}.txz`;
|
||||
export const startingDir = process.cwd();
|
||||
|
||||
export const BASE_URLS = {
|
||||
@@ -15,4 +27,4 @@ export const BASE_URLS = {
|
||||
PREVIEW: "https://preview.dl.unraid.net/unraid-api",
|
||||
} as const;
|
||||
|
||||
export const LOCAL_BUILD_TAG = "LOCAL_PLUGIN_BUILD" as const;
|
||||
export const LOCAL_BUILD_TAG = "LOCAL_PLUGIN_BUILD" as const;
|
||||
|
||||
@@ -4,15 +4,14 @@ import {
|
||||
pluginName,
|
||||
pluginNameWithExt,
|
||||
startingDir,
|
||||
TxzNameParams,
|
||||
} from "./consts";
|
||||
|
||||
export interface PathConfig {
|
||||
startingDir: string;
|
||||
}
|
||||
|
||||
export interface TxzPathConfig extends PathConfig {
|
||||
pluginVersion?: string;
|
||||
}
|
||||
export interface TxzPathConfig extends PathConfig, TxzNameParams {}
|
||||
|
||||
export const deployDir = "deploy" as const;
|
||||
|
||||
@@ -53,7 +52,8 @@ export function getDeployPluginPath({ startingDir }: PathConfig): string {
|
||||
*/
|
||||
export function getTxzPath({
|
||||
startingDir,
|
||||
pluginVersion,
|
||||
version,
|
||||
build,
|
||||
}: TxzPathConfig): string {
|
||||
return join(startingDir, deployDir, getTxzName(pluginVersion));
|
||||
return join(startingDir, deployDir, getTxzName({ version, build }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user