Skip to content

Commit ef15fd2

Browse files
committed
fix version piping to txz url
1 parent debafbe commit ef15fd2

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

plugin/builder/build-plugin.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { readFile, writeFile, mkdir, rename } from "fs/promises";
22
import { $ } from "zx";
33
import { escape as escapeHtml } from "html-sloppy-escaper";
44
import { dirname, join } from "node:path";
5-
import { getTxzName, pluginName, startingDir, defaultArch, defaultBuild } from "./utils/consts";
5+
import {
6+
getTxzName,
7+
pluginName,
8+
startingDir,
9+
defaultArch,
10+
defaultBuild,
11+
} from "./utils/consts";
612
import { getPluginUrl } from "./utils/bucket-urls";
713
import { getMainTxzUrl } from "./utils/bucket-urls";
814
import {
@@ -25,10 +31,17 @@ const checkGit = async () => {
2531
}
2632
};
2733

28-
const moveTxzFile = async ({txzPath, apiVersion, buildNumber}: Pick<PluginEnv, "txzPath" | "apiVersion" | "buildNumber">) => {
29-
const txzName = getTxzName({version: apiVersion, build: buildNumber.toString()});
34+
const moveTxzFile = async ({
35+
txzPath,
36+
apiVersion,
37+
buildNumber,
38+
}: Pick<PluginEnv, "txzPath" | "apiVersion" | "buildNumber">) => {
39+
const txzName = getTxzName({
40+
version: apiVersion,
41+
build: buildNumber.toString(),
42+
});
3043
const targetPath = join(deployDir, txzName);
31-
44+
3245
// Ensure the txz always has the full version name
3346
if (txzPath !== targetPath) {
3447
console.log(`Ensuring TXZ has correct name: ${txzPath} -> ${targetPath}`);
@@ -61,7 +74,7 @@ const buildPlugin = async ({
6174
apiVersion,
6275
}: PluginEnv) => {
6376
console.log(`API version: ${apiVersion}`);
64-
77+
6578
// Update plg file
6679
let plgContent = await readFile(getRootPluginPath({ startingDir }), "utf8");
6780

@@ -71,11 +84,19 @@ const buildPlugin = async ({
7184
version: pluginVersion,
7285
api_version: apiVersion,
7386
arch: defaultArch,
74-
build: defaultBuild,
87+
build: buildNumber.toString(),
7588
plugin_url: getPluginUrl({ baseUrl, tag }),
76-
txz_url: getMainTxzUrl({ baseUrl, apiVersion, tag, build: buildNumber.toString() }),
89+
txz_url: getMainTxzUrl({
90+
baseUrl,
91+
tag,
92+
version: apiVersion,
93+
build: buildNumber.toString(),
94+
}),
7795
txz_sha256: txzSha256,
78-
txz_name: getTxzName({version: apiVersion, build: buildNumber.toString()}),
96+
txz_name: getTxzName({
97+
version: apiVersion,
98+
build: buildNumber.toString(),
99+
}),
79100
...(tag ? { tag } : {}),
80101
};
81102

plugin/builder/utils/bucket-urls.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ interface UrlParams {
1313
tag?: string;
1414
}
1515

16-
interface TxzUrlParams extends UrlParams, TxzNameParams {
17-
apiVersion: string;
18-
}
16+
interface TxzUrlParams extends UrlParams, TxzNameParams {}
1917

2018
/**
2119
* Get the bucket path for the given tag

0 commit comments

Comments
 (0)