mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 01:55:29 +08:00
Compare commits
10 Commits
43d5a36d37
...
5ae47fdd5c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5ae47fdd5c | ||
![]() |
00e5abe1c8 | ||
![]() |
1b06a03d21 | ||
![]() |
75d2e84710 | ||
![]() |
e482f7ce0f | ||
![]() |
d85452eadf | ||
![]() |
01bd2b16cc | ||
![]() |
b7e8a5bdba | ||
![]() |
c7d0025d39 | ||
![]() |
e70fd029fa |
33
CHANGELOG.md
33
CHANGELOG.md
@ -2,6 +2,39 @@
|
|||||||
|
|
||||||
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.
|
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.0.0](https://github.com/peaceiris/actions-hugo/compare/v2.6.0...v3.0.0) (2024-04-02)
|
||||||
|
|
||||||
|
|
||||||
|
### build
|
||||||
|
|
||||||
|
* node 20.11.1 ([01bd2b1](https://github.com/peaceiris/actions-hugo/commit/01bd2b16cc6cadbc63cba9bddb36c689f462c2db))
|
||||||
|
|
||||||
|
### chore
|
||||||
|
|
||||||
|
* npm audit fix ([966dfad](https://github.com/peaceiris/actions-hugo/commit/966dfad3859a5cfc80b6e36761b0b4c7b3dd5e0c))
|
||||||
|
* revert version ([d85452e](https://github.com/peaceiris/actions-hugo/commit/d85452eadfba7065bf8c0601c8c22e427982d108))
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* bump actions/dependency-review-action from 2 to 3 (#622) ([844f873](https://github.com/peaceiris/actions-hugo/commit/844f8735f61722d43677c23cbeae4283af7b554a)), closes [#622](https://github.com/peaceiris/actions-hugo/issues/622)
|
||||||
|
* bump actions/setup-node from 3.5.1 to 3.6.0 (#625) ([3fa8fd6](https://github.com/peaceiris/actions-hugo/commit/3fa8fd6cee4e03774c4e900dca8b766d1cdcae93)), closes [#625](https://github.com/peaceiris/actions-hugo/issues/625)
|
||||||
|
* bump checkout to v4 (#639) ([aadc3a9](https://github.com/peaceiris/actions-hugo/commit/aadc3a98dfd3437f8f97d436ea91b82a73dc85dd)), closes [#639](https://github.com/peaceiris/actions-hugo/issues/639)
|
||||||
|
* bump peaceiris/actions-hugo from 2.5.0 to 2.6.0 (#621) ([b1822b6](https://github.com/peaceiris/actions-hugo/commit/b1822b6abe1a489f9ba7b9b664d916aeafd3e592)), closes [#621](https://github.com/peaceiris/actions-hugo/issues/621)
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* bump ruby version to 3.2 (#629) ([7c4b9f1](https://github.com/peaceiris/actions-hugo/commit/7c4b9f1f99c72728600c292c1f0e7138cc3a8865)), closes [#629](https://github.com/peaceiris/actions-hugo/issues/629)
|
||||||
|
* bump versions (#628) ([7652d53](https://github.com/peaceiris/actions-hugo/commit/7652d5336914f4ecd975baff70cd3c4b5070678b)), closes [#628](https://github.com/peaceiris/actions-hugo/issues/628)
|
||||||
|
* remove braces (#634) ([31c4654](https://github.com/peaceiris/actions-hugo/commit/31c46541ceabb0656cd9e943914ab1701da3e788)), closes [#634](https://github.com/peaceiris/actions-hugo/issues/634)
|
||||||
|
* replace set-output with GITHUB_OUTPUT ([3d92e2f](https://github.com/peaceiris/actions-hugo/commit/3d92e2fd556bef7470d7e2a6aea63141183c20a6))
|
||||||
|
* update cache usage (#636) ([c0084b0](https://github.com/peaceiris/actions-hugo/commit/c0084b0763db3a37f864755d9174f2a6f3e0c1c5)), closes [#636](https://github.com/peaceiris/actions-hugo/issues/636)
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* bump to use node20 runtime (#641) ([c57490a](https://github.com/peaceiris/actions-hugo/commit/c57490a8b04136ae58ab5866a93d3db2f0fa0945)), closes [#641](https://github.com/peaceiris/actions-hugo/issues/641)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.6.0](https://github.com/peaceiris/actions-hugo/compare/v2.5.0...v2.6.0) (2022-10-23)
|
# [2.6.0](https://github.com/peaceiris/actions-hugo/compare/v2.5.0...v2.6.0) (2022-10-23)
|
||||||
|
|
||||||
|
|
||||||
|
14
README.md
14
README.md
@ -91,7 +91,7 @@ jobs:
|
|||||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
# extended: true
|
# extended: true
|
||||||
@ -121,7 +121,7 @@ Set `extended: true` to use a Hugo extended version.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
extended: true
|
extended: true
|
||||||
@ -133,7 +133,7 @@ Set `hugo-version: 'latest'` to use the latest version of Hugo.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: 'latest'
|
hugo-version: 'latest'
|
||||||
```
|
```
|
||||||
@ -190,7 +190,7 @@ Next, add a step to read a Hugo version from the `.env` file.
|
|||||||
echo "HUGO_VERSION=${HUGO_VERSION}" >> "${GITHUB_OUTPUT}"
|
echo "HUGO_VERSION=${HUGO_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
|
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
|
||||||
extended: true
|
extended: true
|
||||||
@ -256,7 +256,7 @@ jobs:
|
|||||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
extended: true
|
extended: true
|
||||||
@ -310,7 +310,7 @@ jobs:
|
|||||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
extended: true
|
extended: true
|
||||||
@ -364,7 +364,7 @@ jobs:
|
|||||||
run: git config core.quotePath false
|
run: git config core.quotePath false
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
```
|
```
|
||||||
|
@ -1,15 +1,121 @@
|
|||||||
import getArch from '../src/get-arch';
|
import getArch from '../src/get-arch';
|
||||||
|
|
||||||
describe('getArch', () => {
|
describe('getArch', () => {
|
||||||
test('processor architecture', () => {
|
const groups = [
|
||||||
expect(getArch('x64')).toBe('64bit');
|
{
|
||||||
expect(getArch('arm')).toBe('ARM');
|
condition: 'when hugo version < 0.102.0',
|
||||||
expect(getArch('arm64')).toBe('ARM64');
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: false,
|
||||||
|
dropped32BitSupport: false,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: false,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ arch: 'x64', os: 'linux', expected: '64bit' },
|
||||||
|
{ arch: 'x64', os: 'macOS', expected: '64bit' },
|
||||||
|
{ arch: 'x64', os: 'windows', expected: '64bit' },
|
||||||
|
{ arch: 'arm', os: 'linux', expected: 'ARM' },
|
||||||
|
{ arch: 'arm', os: 'macOS', expected: 'ARM' },
|
||||||
|
{ arch: 'arm', os: 'windows', expected: 'ARM' },
|
||||||
|
{ arch: 'arm64', os: 'linux', expected: 'ARM64' },
|
||||||
|
{ arch: 'arm64', os: 'macOS', expected: 'ARM64' },
|
||||||
|
{ arch: 'arm64', os: 'windows', expected: 'ARM64' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version === 0.102.z',
|
||||||
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ arch: 'x64', os: 'linux', expected: '64bit' },
|
||||||
|
{ arch: 'x64', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'x64', os: 'windows', expected: '64bit' },
|
||||||
|
{ arch: 'arm', os: 'linux', throws: true },
|
||||||
|
{ arch: 'arm', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'arm', os: 'windows', throws: true },
|
||||||
|
{ arch: 'arm64', os: 'linux', expected: 'ARM64' },
|
||||||
|
{ arch: 'arm64', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'arm64', os: 'windows', expected: 'ARM64' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version >= 0.103.0',
|
||||||
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: true,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ arch: 'x64', os: 'linux', expected: 'amd64' },
|
||||||
|
{ arch: 'x64', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'x64', os: 'windows', expected: 'amd64' },
|
||||||
|
{ arch: 'arm', os: 'linux', throws: true },
|
||||||
|
{ arch: 'arm', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'arm', os: 'windows', throws: true },
|
||||||
|
{ arch: 'arm64', os: 'linux', expected: 'arm64' },
|
||||||
|
{ arch: 'arm64', os: 'macOS', expected: 'universal' },
|
||||||
|
{ arch: 'arm64', os: 'windows', expected: 'arm64' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when the architecture is unsupported for the action',
|
||||||
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: false,
|
||||||
|
dropped32BitSupport: false,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: false,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ arch: 'mips', os: 'linux', throws: true}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
].map(function (group) {
|
||||||
|
group.tests = group.tests.map(function (example) {
|
||||||
|
return Object.assign(example, {
|
||||||
|
toString: function () {
|
||||||
|
let name = `${example.os} on ${example.arch} `
|
||||||
|
name += example?.throws ? 'throws as not supported' : `returns ${example.expected}`
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
return Object.assign(group, { toString: function () { return group.condition } });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exception', () => {
|
describe.each(groups)('%s', ({ conventions, tests }) => {
|
||||||
expect(() => {
|
test.each(tests)('%s', ({ arch, os, throws, expected }) => {
|
||||||
getArch('mips');
|
if (throws) {
|
||||||
}).toThrowError('mips is not supported');
|
expect(() => {
|
||||||
});
|
getArch(arch, os, conventions)
|
||||||
|
}).toThrow(`${arch} is not supported`);
|
||||||
|
} else {
|
||||||
|
expect(getArch(arch, os, conventions)).toBe(expected);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
57
__tests__/get-conventions.test.ts
Normal file
57
__tests__/get-conventions.test.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import getConventions from "../src/get-conventions";
|
||||||
|
|
||||||
|
describe('getConventions()', () => {
|
||||||
|
const groups = [
|
||||||
|
{
|
||||||
|
condition: 'when hugo version < 0.102.0',
|
||||||
|
version: '0.101.0',
|
||||||
|
expected: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: false,
|
||||||
|
dropped32BitSupport: false,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: false,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version === 0.102.z',
|
||||||
|
version: '0.102.0',
|
||||||
|
expected: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version >= 0.103.0',
|
||||||
|
version: '0.103.0',
|
||||||
|
expected: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: true,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].map(function (group) {
|
||||||
|
return Object.assign(group, { toString: function () { return group.condition } });
|
||||||
|
});
|
||||||
|
|
||||||
|
test.each(groups)('%s', ({ expected, version }) => {
|
||||||
|
expect(getConventions(version)).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
@ -1,15 +1,96 @@
|
|||||||
import getOS from '../src/get-os';
|
import getOS from '../src/get-os';
|
||||||
|
|
||||||
describe('getOS', () => {
|
describe('getOS', () => {
|
||||||
test('os type', () => {
|
const groups = [
|
||||||
expect(getOS('linux')).toBe('Linux');
|
{
|
||||||
expect(getOS('darwin')).toBe('macOS');
|
condition: 'when hugo version < 0.102.0',
|
||||||
expect(getOS('win32')).toBe('Windows');
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: false,
|
||||||
|
dropped32BitSupport: false,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: false,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ os: 'linux', expected: 'Linux' },
|
||||||
|
{ os: 'darwin', expected: 'macOS' },
|
||||||
|
{ os: 'win32', expected: 'Windows' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version === 0.102.z',
|
||||||
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ os: 'linux', expected: 'Linux' },
|
||||||
|
{ os: 'darwin', expected: 'darwin' },
|
||||||
|
{ os: 'win32', expected: 'Windows' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition: 'when hugo version >= 0.103.0',
|
||||||
|
conventions: {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: true,
|
||||||
|
dropped32BitSupport: true,
|
||||||
|
standardizedNaming: true,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: true,
|
||||||
|
downcasedAll: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tests: [
|
||||||
|
{ os: 'linux', expected: 'linux' },
|
||||||
|
{ os: 'darwin', expected: 'darwin' },
|
||||||
|
{ os: 'win32', expected: 'windows' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
].map(function (group) {
|
||||||
|
group.tests = group.tests.map(function (example) {
|
||||||
|
return Object.assign(example, {
|
||||||
|
toString: function () {
|
||||||
|
return `${example.os} returns ${example.expected}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
return Object.assign(group, { toString: function () { return group.condition } });
|
||||||
|
});
|
||||||
|
|
||||||
|
describe.each(groups)('%s', ({ conventions, tests }) => {
|
||||||
|
test.each(tests)('%s', ({ os, expected }) => {
|
||||||
|
expect(getOS(os, conventions)).toBe(expected);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exception', () => {
|
test('exception', () => {
|
||||||
|
const conventions = {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: false,
|
||||||
|
dropped32BitSupport: false,
|
||||||
|
standardizedNaming: false,
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: false,
|
||||||
|
downcasedAll: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
getOS('centos');
|
getOS('centos', conventions);
|
||||||
}).toThrowError('centos is not supported');
|
}).toThrow('centos is not supported');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -6,7 +6,7 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "actions-hugo",
|
"name": "actions-hugo",
|
||||||
"version": "3.0.0",
|
"version": "2.6.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
export default function getArch(arch: string): string {
|
import { conventions } from "./get-conventions";
|
||||||
|
|
||||||
|
export default function getArch(arch: string, os: string, conventions: conventions): string {
|
||||||
|
if (os == 'darwin' || os == 'macOS' && conventions.arch.darwinUniversal) {
|
||||||
|
return 'universal'
|
||||||
|
}
|
||||||
|
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'x64':
|
case 'x64':
|
||||||
return '64bit';
|
return conventions.arch.standardizedNaming ? 'amd64': '64bit' ;
|
||||||
case 'arm':
|
case 'arm':
|
||||||
|
if (conventions.arch.dropped32BitSupport) {
|
||||||
|
throw new Error(`${arch} is not supported`);
|
||||||
|
}
|
||||||
|
|
||||||
return 'ARM';
|
return 'ARM';
|
||||||
case 'arm64':
|
case 'arm64':
|
||||||
return 'ARM64';
|
return conventions.arch.standardizedNaming ? 'arm64' : 'ARM64';
|
||||||
default:
|
default:
|
||||||
throw new Error(`${arch} is not supported`);
|
throw new Error(`${arch} is not supported`);
|
||||||
}
|
}
|
||||||
|
29
src/get-conventions.ts
Normal file
29
src/get-conventions.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
export interface conventions {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: boolean,
|
||||||
|
dropped32BitSupport: boolean,
|
||||||
|
standardizedNaming: boolean
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: boolean,
|
||||||
|
downcasedAll: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function getConventions(version: string,): conventions {
|
||||||
|
const segments = version.split('.').map(s => parseInt(s));
|
||||||
|
const stableOrNewer = segments[0] > 0;
|
||||||
|
const newerThan103 = stableOrNewer || segments[1] >= 103
|
||||||
|
const newerThan102 = stableOrNewer || segments[1] >= 102
|
||||||
|
return {
|
||||||
|
arch: {
|
||||||
|
darwinUniversal: newerThan102,
|
||||||
|
dropped32BitSupport: newerThan102,
|
||||||
|
standardizedNaming: newerThan103
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
renamedMacOS: newerThan102,
|
||||||
|
downcasedAll: newerThan103
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
export default function getOS(platform: string): string {
|
import { conventions } from "./get-conventions";
|
||||||
|
|
||||||
|
export default function getOS(platform: string, conventions: conventions): string {
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return 'Linux';
|
return conventions.os.downcasedAll ? 'linux' : 'Linux'
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return 'macOS';
|
return conventions.os.renamedMacOS ? 'darwin' : 'macOS'
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return 'Windows';
|
return conventions.os.downcasedAll ? 'windows' : 'Windows'
|
||||||
default:
|
default:
|
||||||
throw new Error(`${platform} is not supported`);
|
throw new Error(`${platform} is not supported`);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
|
import getConventions from './get-conventions';
|
||||||
import getOS from './get-os';
|
import getOS from './get-os';
|
||||||
import getArch from './get-arch';
|
import getArch from './get-arch';
|
||||||
import getURL from './get-url';
|
import getURL from './get-url';
|
||||||
@ -47,10 +48,12 @@ export async function installer(version: string): Promise<void> {
|
|||||||
const extended: string = core.getInput('extended');
|
const extended: string = core.getInput('extended');
|
||||||
core.debug(`Hugo extended: ${extended}`);
|
core.debug(`Hugo extended: ${extended}`);
|
||||||
|
|
||||||
const osName: string = getOS(process.platform);
|
const conventions = getConventions(version);
|
||||||
|
|
||||||
|
const osName: string = getOS(process.platform, conventions);
|
||||||
core.debug(`Operating System: ${osName}`);
|
core.debug(`Operating System: ${osName}`);
|
||||||
|
|
||||||
const archName: string = getArch(process.arch);
|
const archName: string = getArch(process.arch, osName, conventions);
|
||||||
core.debug(`Processor Architecture: ${archName}`);
|
core.debug(`Processor Architecture: ${archName}`);
|
||||||
|
|
||||||
const toolURL: string = getURL(osName, archName, extended, version);
|
const toolURL: string = getURL(osName, archName, extended, version);
|
||||||
|
Loading…
Reference in New Issue
Block a user