mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 01:55:29 +08:00
fix: downloads
This commit is contained in:
parent
aadc3a98df
commit
e0c3fda2cf
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@ -8,17 +8,17 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL-Build:
|
CodeQL-Build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
4
.github/workflows/dependency-review.yml
vendored
4
.github/workflows/dependency-review.yml
vendored
@ -10,7 +10,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dependency-review:
|
dependency-review:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/dependency-review-action@v3
|
- uses: actions/dependency-review-action@v4
|
||||||
|
2
.github/workflows/dev-image.yml
vendored
2
.github/workflows/dev-image.yml
vendored
@ -23,7 +23,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dev-image-test:
|
dev-image-test:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: make build
|
- run: make build
|
||||||
|
2
.github/workflows/label-commenter.yml
vendored
2
.github/workflows/label-commenter.yml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
comment:
|
comment:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
@ -6,7 +6,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
purge:
|
purge:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- run: >
|
- run: >
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
7
.github/workflows/test-action.yml
vendored
7
.github/workflows/test-action.yml
vendored
@ -11,14 +11,13 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- 'ubuntu-22.04'
|
|
||||||
- 'ubuntu-20.04'
|
- 'ubuntu-20.04'
|
||||||
- 'ubuntu-latest'
|
- 'ubuntu-latest'
|
||||||
- 'macos-latest'
|
- 'macos-latest'
|
||||||
- 'windows-latest'
|
- 'windows-latest'
|
||||||
hugo-version:
|
hugo-version:
|
||||||
- 'latest'
|
- 'latest'
|
||||||
- '0.61.0'
|
- '0.103.0'
|
||||||
extended:
|
extended:
|
||||||
- true
|
- true
|
||||||
- false
|
- false
|
||||||
@ -26,13 +25,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.6.0
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: ${{ matrix.hugo-version }}
|
hugo-version: ${{ matrix.hugo-version }}
|
||||||
extended: ${{ matrix.extended }}
|
extended: ${{ matrix.extended }}
|
||||||
|
|
||||||
- name: Run hugo version
|
- name: Run hugo version
|
||||||
run: echo "::set-output name=hugo_version::$(hugo version)"
|
run: echo "hugo_version=$(hugo version)" >> $GITHUB_OUTPUT
|
||||||
id: hugo_version
|
id: hugo_version
|
||||||
|
|
||||||
- name: '${{ steps.hugo_version.outputs.hugo_version }}'
|
- name: '${{ steps.hugo_version.outputs.hugo_version }}'
|
||||||
|
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
@ -16,7 +16,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- 'ubuntu-22.04'
|
|
||||||
- 'ubuntu-20.04'
|
- 'ubuntu-20.04'
|
||||||
- 'ubuntu-latest'
|
- 'ubuntu-latest'
|
||||||
- 'macos-latest'
|
- 'macos-latest'
|
||||||
@ -25,34 +24,34 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Read .nvmrc
|
- name: Read .nvmrc
|
||||||
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
||||||
id: nvm
|
id: nvm
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
- name: Run prettier
|
- name: Run prettier
|
||||||
if: startsWith(matrix.os, 'ubuntu-22.04')
|
if: startsWith(matrix.os, 'ubuntu-latest')
|
||||||
run: npm run format:check
|
run: npm run format:check
|
||||||
|
|
||||||
- name: Run eslint
|
- name: Run eslint
|
||||||
if: startsWith(matrix.os, 'ubuntu-22.04')
|
if: startsWith(matrix.os, 'ubuntu-latest')
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Run ncc
|
- name: Run ncc
|
||||||
if: startsWith(matrix.os, 'ubuntu-22.04')
|
if: startsWith(matrix.os, 'ubuntu-latest')
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- name: Upload test coverage as artifact
|
- name: Upload test coverage as artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverage-${{ matrix.os }}
|
name: coverage-${{ matrix.os }}
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v4
|
||||||
|
2
.github/workflows/update-major-tag.yml
vendored
2
.github/workflows/update-major-tag.yml
vendored
@ -6,7 +6,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
14
README.md
14
README.md
@ -24,7 +24,7 @@ We no longer build or pull a Hugo docker image.
|
|||||||
Thanks to this change, we can complete this action in less than a few seconds.
|
Thanks to this change, we can complete this action in less than a few seconds.
|
||||||
(A docker base action was taking about 1 min or more execution time to build and pull a docker image.)
|
(A docker base action was taking about 1 min or more execution time to build and pull a docker image.)
|
||||||
|
|
||||||
| OS (runs-on) | ubuntu-latest, ubuntu-20.04, ubuntu-22.04 | macos-latest | windows-2019 |
|
| OS (runs-on) | ubuntu-latest, ubuntu-20.04 | macos-latest | windows-latest |
|
||||||
|---|:---:|:---:|:---:|
|
|---|:---:|:---:|:---:|
|
||||||
| Support | ✅️ | ✅️ | ✅️ |
|
| Support | ✅️ | ✅️ | ✅️ |
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
steps:
|
steps:
|
||||||
@ -154,7 +154,7 @@ Insert a cache step before site-building as follows.
|
|||||||
Note that with latest hugo version, the [cache dir location](https://gohugo.io/getting-started/configuration/#configure-cachedir) on a Linux-based operating system is `${HOME}/.cache`. On macOS, `${HOME}/Library/Caches` has the location.
|
Note that with latest hugo version, the [cache dir location](https://gohugo.io/getting-started/configuration/#configure-cachedir) on a Linux-based operating system is `${HOME}/.cache`. On macOS, `${HOME}/Library/Caches` has the location.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: /home/runner/.cache/hugo_cache # <-- with hugo version v0.116.0 and above
|
path: /home/runner/.cache/hugo_cache # <-- with hugo version v0.116.0 and above
|
||||||
# path: /tmp/hugo_cache # <-- with hugo version < v0.116.0
|
# path: /tmp/hugo_cache # <-- with hugo version < v0.116.0
|
||||||
@ -247,7 +247,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
steps:
|
steps:
|
||||||
@ -262,7 +262,7 @@ jobs:
|
|||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -301,7 +301,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
steps:
|
steps:
|
||||||
@ -353,7 +353,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -2,9 +2,9 @@ import getArch from '../src/get-arch';
|
|||||||
|
|
||||||
describe('getArch', () => {
|
describe('getArch', () => {
|
||||||
test('processor architecture', () => {
|
test('processor architecture', () => {
|
||||||
expect(getArch('x64')).toBe('64bit');
|
expect(getArch('x64')).toBe('amd64');
|
||||||
expect(getArch('arm')).toBe('ARM');
|
expect(getArch('arm')).toBe('arm');
|
||||||
expect(getArch('arm64')).toBe('ARM64');
|
expect(getArch('arm64')).toBe('arm64');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exception', () => {
|
test('exception', () => {
|
||||||
|
@ -2,9 +2,9 @@ import getOS from '../src/get-os';
|
|||||||
|
|
||||||
describe('getOS', () => {
|
describe('getOS', () => {
|
||||||
test('os type', () => {
|
test('os type', () => {
|
||||||
expect(getOS('linux')).toBe('Linux');
|
expect(getOS('linux')).toBe('linux');
|
||||||
expect(getOS('darwin')).toBe('macOS');
|
expect(getOS('darwin')).toBe('darwin');
|
||||||
expect(getOS('win32')).toBe('Windows');
|
expect(getOS('win32')).toBe('windows');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exception', () => {
|
test('exception', () => {
|
||||||
|
@ -2,19 +2,19 @@ import getURL from '../src/get-url';
|
|||||||
|
|
||||||
describe('getURL()', () => {
|
describe('getURL()', () => {
|
||||||
test('get a URL to an asset for each platform', () => {
|
test('get a URL to an asset for each platform', () => {
|
||||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.122.0';
|
||||||
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
const urlLinux = `${baseURL}/hugo_0.122.0_linux-amd64.tar.gz`;
|
||||||
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
|
const urlLinuxExtended = `${baseURL}/hugo_extended_0.122.0_linux-amd64.tar.gz`;
|
||||||
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
const urlMacOS = `${baseURL}/hugo_0.122.0_darwin-universal.tar.gz`;
|
||||||
const urlMacOSExtended = `${baseURL}/hugo_extended_0.58.2_macOS-64bit.tar.gz`;
|
const urlMacOSExtended = `${baseURL}/hugo_extended_0.122.0_darwin-universal.tar.gz`;
|
||||||
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
const urlWindows = `${baseURL}/hugo_0.122.0_windows-amd64.zip`;
|
||||||
expect(getURL('Linux', '64bit', 'false', '0.58.2')).toBe(urlLinux);
|
expect(getURL('linux', 'amd64', 'false', '0.122.0')).toBe(urlLinux);
|
||||||
expect(getURL('Linux', '64bit', 'true', '0.58.2')).not.toBe(urlLinux);
|
expect(getURL('linux', 'amd64', 'true', '0.122.0')).not.toBe(urlLinux);
|
||||||
expect(getURL('MyOS', '64bit', 'false', '0.58.2')).not.toBe(urlLinux);
|
expect(getURL('MyOS', 'amd64', 'false', '0.122.0')).not.toBe(urlLinux);
|
||||||
expect(getURL('Linux', '64bit', 'false', '0.58.1')).not.toBe(urlLinux);
|
expect(getURL('linux', 'amd64', 'false', '0.121.0')).not.toBe(urlLinux);
|
||||||
expect(getURL('Linux', '64bit', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
expect(getURL('linux', 'amd64', 'true', '0.122.0')).toBe(urlLinuxExtended);
|
||||||
expect(getURL('macOS', '64bit', 'false', '0.58.2')).toBe(urlMacOS);
|
expect(getURL('darwin', 'universal', 'false', '0.122.0')).toBe(urlMacOS);
|
||||||
expect(getURL('macOS', '64bit', 'true', '0.58.2')).toBe(urlMacOSExtended);
|
expect(getURL('darwin', 'universal', 'true', '0.122.0')).toBe(urlMacOSExtended);
|
||||||
expect(getURL('Windows', '64bit', 'false', '0.58.2')).toBe(urlWindows);
|
expect(getURL('windows', 'amd64', 'false', '0.122.0')).toBe(urlWindows);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
1969
package-lock.json
generated
1969
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,13 @@
|
|||||||
export default function getArch(arch: string): string {
|
export default function getArch(arch: string): string {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'x64':
|
case 'x64':
|
||||||
return '64bit';
|
return 'amd64';
|
||||||
case 'arm':
|
case 'arm':
|
||||||
return 'ARM';
|
return 'arm';
|
||||||
case 'arm64':
|
case 'arm64':
|
||||||
return 'ARM64';
|
return 'arm64';
|
||||||
|
case 'universal':
|
||||||
|
return 'universal';
|
||||||
default:
|
default:
|
||||||
throw new Error(`${arch} is not supported`);
|
throw new Error(`${arch} is not supported`);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
export default function getOS(platform: string): string {
|
export default function getOS(platform: string): string {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return 'Linux';
|
return 'linux';
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return 'macOS';
|
return 'darwin';
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return 'Windows';
|
return 'windows';
|
||||||
default:
|
default:
|
||||||
throw new Error(`${platform} is not supported`);
|
throw new Error(`${platform} is not supported`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user