fix: include extended & with deploy in tool version for proper caching
This commit is contained in:
parent
10b6b9aa45
commit
35de0fc568
4 changed files with 44 additions and 19 deletions
|
@ -60,6 +60,7 @@ jobs:
|
||||||
extended: true
|
extended: true
|
||||||
dart-sass: true
|
dart-sass: true
|
||||||
with-deploy: true
|
with-deploy: true
|
||||||
|
github-token: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Test installed tools
|
- name: Test installed tools
|
||||||
id: test-tools
|
id: test-tools
|
||||||
|
|
38
dist/index.js
vendored
38
dist/index.js
vendored
|
@ -50809,13 +50809,21 @@ class HugoInstaller {
|
||||||
}
|
}
|
||||||
async install(cmd) {
|
async install(cmd) {
|
||||||
const release = await this.releaseLookup.getRelease(Hugo.Org, Hugo.Repo, cmd.version, HugoReleaseTransformer);
|
const release = await this.releaseLookup.getRelease(Hugo.Org, Hugo.Repo, cmd.version, HugoReleaseTransformer);
|
||||||
core.debug(`Hugo extended: ${cmd.extended}`);
|
core.debug(`Hugo extended: ${cmd.extended ?? false}`);
|
||||||
|
core.debug(`Hugo with deploy: ${cmd.withDeploy ?? false}`);
|
||||||
core.debug(`Operating System: ${this.platform.os}`);
|
core.debug(`Operating System: ${this.platform.os}`);
|
||||||
core.debug(`Processor Architecture: ${this.platform.arch}`);
|
core.debug(`Processor Architecture: ${this.platform.arch}`);
|
||||||
const hugoBinName = this.platform.binaryName(Hugo.CmdName);
|
const hugoBinName = this.platform.binaryName(Hugo.CmdName);
|
||||||
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
||||||
|
let versionSpec = release.tag_name;
|
||||||
|
if (cmd.extended) {
|
||||||
|
versionSpec += '+extended';
|
||||||
|
}
|
||||||
|
if (cmd.withDeploy) {
|
||||||
|
versionSpec += '+withdeploy';
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const cachedTool = tool_cache.find(Hugo.Name, release.tag_name, this.platform.arch);
|
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
||||||
if (cachedTool) {
|
if (cachedTool) {
|
||||||
core.addPath(cachedTool);
|
core.addPath(cachedTool);
|
||||||
return;
|
return;
|
||||||
|
@ -50839,7 +50847,7 @@ class HugoInstaller {
|
||||||
}
|
}
|
||||||
await (0,io.rmRF)(destPath);
|
await (0,io.rmRF)(destPath);
|
||||||
try {
|
try {
|
||||||
const cachedHugoPath = await tool_cache.cacheFile(external_path_default().join(tmpDir, hugoBinName), hugoBinName, Hugo.Name, release.tag_name, this.platform.arch);
|
const cachedHugoPath = await tool_cache.cacheFile(external_path_default().join(tmpDir, hugoBinName), hugoBinName, Hugo.Name, versionSpec, this.platform.arch);
|
||||||
core.addPath(cachedHugoPath);
|
core.addPath(cachedHugoPath);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
@ -50857,16 +50865,21 @@ const HugoReleaseTransformer = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class HugoRelease {
|
class HugoRelease {
|
||||||
static keyReplacementRegex = new RegExp('hugo_(extended_)*(\\d+.\\d+.\\d+)_');
|
static keyReplacementRegex = new RegExp('hugo_(extended_)*(withdeploy_)*(\\d+.\\d+.\\d+)_');
|
||||||
tag_name;
|
tag_name;
|
||||||
defaultAssets;
|
defaultAssets;
|
||||||
extendedAssets;
|
extendedAssets;
|
||||||
|
withDeployAssets;
|
||||||
constructor(tag_name, assets) {
|
constructor(tag_name, assets) {
|
||||||
this.tag_name = tag_name;
|
this.tag_name = tag_name;
|
||||||
this.defaultAssets = new Map();
|
this.defaultAssets = new Map();
|
||||||
this.extendedAssets = new Map();
|
this.extendedAssets = new Map();
|
||||||
|
this.withDeployAssets = new Map();
|
||||||
for (const asset of assets) {
|
for (const asset of assets) {
|
||||||
if (asset.name.includes('extended')) {
|
if (asset.name.includes('extended_withdeploy')) {
|
||||||
|
this.withDeployAssets.set(asset.name.replace(HugoRelease.keyReplacementRegex, ''), asset.browser_download_url);
|
||||||
|
}
|
||||||
|
else if (asset.name.includes('extended')) {
|
||||||
this.extendedAssets.set(asset.name.replace(HugoRelease.keyReplacementRegex, ''), asset.browser_download_url);
|
this.extendedAssets.set(asset.name.replace(HugoRelease.keyReplacementRegex, ''), asset.browser_download_url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -50874,11 +50887,17 @@ class HugoRelease {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assetUrl(platform, extended) {
|
assetUrl(platform, extended, withDeploy) {
|
||||||
const src = extended ? this.extendedAssets : this.defaultAssets;
|
let assets = this.defaultAssets;
|
||||||
|
if (extended) {
|
||||||
|
assets = this.extendedAssets;
|
||||||
|
}
|
||||||
|
else if (withDeploy) {
|
||||||
|
assets = this.withDeployAssets;
|
||||||
|
}
|
||||||
const arch = platform.os === 'darwin' ? 'universal' : platform.arch;
|
const arch = platform.os === 'darwin' ? 'universal' : platform.arch;
|
||||||
const key = `${platform.os}-${arch}${platform.archiveExtension()}`;
|
const key = `${platform.os}-${arch}${platform.archiveExtension()}`;
|
||||||
return src.get(key);
|
return assets.get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51006,7 +51025,8 @@ async function run() {
|
||||||
const hugoInstaller = new HugoInstaller(releaseLookup);
|
const hugoInstaller = new HugoInstaller(releaseLookup);
|
||||||
await hugoInstaller.install({
|
await hugoInstaller.install({
|
||||||
version: core.getInput('hugo-version'),
|
version: core.getInput('hugo-version'),
|
||||||
extended: core.getBooleanInput('extended')
|
extended: core.getBooleanInput('extended'),
|
||||||
|
withDeploy: core.getBooleanInput('with-deploy')
|
||||||
});
|
});
|
||||||
if (!core.getBooleanInput('dart-sass'))
|
if (!core.getBooleanInput('dart-sass'))
|
||||||
return;
|
return;
|
||||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
22
src/hugo.ts
22
src/hugo.ts
|
@ -41,12 +41,16 @@ export class HugoInstaller {
|
||||||
const hugoBinName = this.platform.binaryName(Hugo.CmdName)
|
const hugoBinName = this.platform.binaryName(Hugo.CmdName)
|
||||||
const tmpDir = os.tmpdir()
|
const tmpDir = os.tmpdir()
|
||||||
|
|
||||||
|
let versionSpec = release.tag_name
|
||||||
|
if (cmd.extended) {
|
||||||
|
versionSpec += '+extended'
|
||||||
|
}
|
||||||
|
if (cmd.withDeploy) {
|
||||||
|
versionSpec += '+withdeploy'
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const cachedTool = tc.find(
|
const cachedTool = tc.find(Hugo.Name, versionSpec, this.platform.arch)
|
||||||
Hugo.Name,
|
|
||||||
release.tag_name,
|
|
||||||
this.platform.arch
|
|
||||||
)
|
|
||||||
if (cachedTool) {
|
if (cachedTool) {
|
||||||
core.addPath(cachedTool)
|
core.addPath(cachedTool)
|
||||||
return
|
return
|
||||||
|
@ -81,7 +85,7 @@ export class HugoInstaller {
|
||||||
path.join(tmpDir, hugoBinName),
|
path.join(tmpDir, hugoBinName),
|
||||||
hugoBinName,
|
hugoBinName,
|
||||||
Hugo.Name,
|
Hugo.Name,
|
||||||
release.tag_name,
|
versionSpec,
|
||||||
this.platform.arch
|
this.platform.arch
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -149,10 +153,10 @@ export class HugoRelease implements IGithubRelease {
|
||||||
withDeploy?: boolean
|
withDeploy?: boolean
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
let assets = this.defaultAssets
|
let assets = this.defaultAssets
|
||||||
if (withDeploy) {
|
if (extended) {
|
||||||
assets = this.withDeployAssets
|
|
||||||
} else if (extended) {
|
|
||||||
assets = this.extendedAssets
|
assets = this.extendedAssets
|
||||||
|
} else if (withDeploy) {
|
||||||
|
assets = this.withDeployAssets
|
||||||
}
|
}
|
||||||
|
|
||||||
const arch = platform.os === 'darwin' ? 'universal' : platform.arch
|
const arch = platform.os === 'darwin' ? 'universal' : platform.arch
|
||||||
|
|
Loading…
Reference in a new issue