Compare commits

...

4 Commits

Author SHA1 Message Date
peaceiris 2752ce1d29 chore(release): 3.2.1 2026-05-11 01:05:33 +09:00
peaceiris d8391e68b0 chore(release): Add build assets 2026-05-11 01:05:32 +09:00
Shohei Ueda 4e5bf412f0 fix: handle Hugo 0.139.5 archive fallback (#696)
Co-authored-by: Codex <noreply@openai.com>
2026-05-11 01:05:09 +09:00
peaceiris c2f9fa4376 chore(release): Remove build assets [skip ci] 2026-05-11 00:27:27 +09:00
7 changed files with 61 additions and 11 deletions
+9
View File
@@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [3.2.1](https://github.com/peaceiris/actions-hugo/compare/v3.2.0...v3.2.1) (2026-05-10)
### fix
* handle Hugo 0.139.5 archive fallback (#696) ([4e5bf41](https://github.com/peaceiris/actions-hugo/commit/4e5bf412f00ba628ed366436825de7226933f80d)), closes [#696](https://github.com/peaceiris/actions-hugo/issues/696)
# [3.2.0](https://github.com/peaceiris/actions-hugo/compare/v3.1.0...v3.2.0) (2026-05-10)
+14 -1
View File
@@ -1,4 +1,4 @@
import getURL from '../src/get-url';
import getURL, {getDownloadVersion} from '../src/get-url';
describe('getURL()', () => {
test('get URLs to Linux assets', () => {
@@ -139,6 +139,19 @@ describe('getURL()', () => {
]);
});
test('get URLs to Hugo 0.139.5 archive alias', () => {
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.139.4';
expect(getDownloadVersion('0.139.5')).toBe('0.139.4');
expect(getURL('linux', 'amd64', 'true', '0.139.5')).toEqual([
`${baseURL}/hugo_extended_0.139.4_linux-amd64.tar.gz`,
`${baseURL}/hugo_extended_0.139.4_Linux-amd64.tar.gz`,
`${baseURL}/hugo_extended_0.139.4_Linux_amd64.tar.gz`,
`${baseURL}/hugo_extended_v0.139.4_linux-amd64.tar.gz`,
`${baseURL}/hugo_extended_v0.139.4_Linux-amd64.tar.gz`,
`${baseURL}/hugo_extended_v0.139.4_Linux_amd64.tar.gz`
]);
});
test('get a fallback URL to an unknown OS asset', () => {
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
expect(getURL('MyOS', '64bit', 'false', '0.58.2')).toEqual([
+14 -3
View File
@@ -42279,6 +42279,7 @@ function getArch(arch, os, conventions) {
;// CONCATENATED MODULE: ./src/get-url.ts
function get_url_getURL(os, arch, extended, version) {
const downloadVersion = getDownloadVersion(version);
const extendedStr = (extended) => {
if (extended === 'true') {
return 'extended_';
@@ -42300,12 +42301,12 @@ function get_url_getURL(os, arch, extended, version) {
}
};
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
const assetBase = `hugo_${extendedStr(extended)}${version}_`;
const legacyVersionedAssetBase = `hugo_${extendedStr(extended)}v${version}_`;
const assetBase = `hugo_${extendedStr(extended)}${downloadVersion}_`;
const legacyVersionedAssetBase = `hugo_${extendedStr(extended)}v${downloadVersion}_`;
const assetBases = [assetBase, legacyVersionedAssetBase];
const assetURLs = (assetNames) => {
return Array.from(new Set(assetNames)).map(assetName => {
return `${baseURL}/v${version}/${assetName}`;
return `${baseURL}/v${downloadVersion}/${assetName}`;
});
};
if (os === 'macOS') {
@@ -42337,6 +42338,12 @@ function get_url_getURL(os, arch, extended, version) {
}
return assetURLs([`${assetBase}${os}-${arch}.tar.gz`]);
}
function getDownloadVersion(version) {
if (version === '0.139.5') {
return '0.139.4';
}
return version;
}
;// CONCATENATED MODULE: ./src/constants.ts
const Tool = {
@@ -42449,6 +42456,10 @@ async function installer(version) {
const archName = getArch(process.arch, osName, conventions);
core_debug(`Processor Architecture: ${archName}`);
const toolURLs = get_url_getURL(osName, archName, extended, version);
const downloadVersion = getDownloadVersion(version);
if (downloadVersion !== version) {
info(`Hugo ${version} release does not publish archives; downloading v${downloadVersion} archives instead.`);
}
const workDir = await createWorkDir();
const binDir = await createBinDir(workDir);
const tempDir = await createTempDir(workDir);
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "actions-hugo",
"version": "3.2.0",
"version": "3.2.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "actions-hugo",
"version": "3.2.0",
"version": "3.2.1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "actions-hugo",
"version": "3.2.0",
"version": "3.2.1",
"description": "GitHub Actions for Hugo",
"main": "lib/index.js",
"engines": {
+14 -3
View File
@@ -4,6 +4,8 @@ export default function getURL(
extended: string,
version: string
): string[] {
const downloadVersion = getDownloadVersion(version);
const extendedStr = (extended: string): string => {
if (extended === 'true') {
return 'extended_';
@@ -28,12 +30,12 @@ export default function getURL(
};
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
const assetBase = `hugo_${extendedStr(extended)}${version}_`;
const legacyVersionedAssetBase = `hugo_${extendedStr(extended)}v${version}_`;
const assetBase = `hugo_${extendedStr(extended)}${downloadVersion}_`;
const legacyVersionedAssetBase = `hugo_${extendedStr(extended)}v${downloadVersion}_`;
const assetBases = [assetBase, legacyVersionedAssetBase];
const assetURLs = (assetNames: string[]): string[] => {
return Array.from(new Set(assetNames)).map(assetName => {
return `${baseURL}/v${version}/${assetName}`;
return `${baseURL}/v${downloadVersion}/${assetName}`;
});
};
@@ -82,3 +84,12 @@ export default function getURL(
return assetURLs([`${assetBase}${os}-${arch}.tar.gz`]);
}
export function getDownloadVersion(version: string): string {
if (version === '0.139.5') {
// v0.139.5 has no release archives; Hugo publishes the same archives under v0.139.4.
return '0.139.4';
}
return version;
}
+7 -1
View File
@@ -5,7 +5,7 @@ import * as exec from '@actions/exec';
import {getConventions} from './get-conventions';
import getOS from './get-os';
import getArch from './get-arch';
import getURL from './get-url';
import getURL, {getDownloadVersion} from './get-url';
import * as path from 'path';
import {Tool, Action} from './constants';
@@ -123,6 +123,12 @@ export async function installer(version: string): Promise<void> {
core.debug(`Processor Architecture: ${archName}`);
const toolURLs: string[] = getURL(osName, archName, extended, version);
const downloadVersion = getDownloadVersion(version);
if (downloadVersion !== version) {
core.info(
`Hugo ${version} release does not publish archives; downloading v${downloadVersion} archives instead.`
);
}
const workDir = await createWorkDir();
const binDir = await createBinDir(workDir);