Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2752ce1d29 | |||
| d8391e68b0 | |||
| 4e5bf412f0 | |||
| c2f9fa4376 | |||
| cf03c8dbc2 | |||
| 50c0903488 | |||
| 681f914d18 | |||
| 7c673b8b9e | |||
| 27f9d4ab07 | |||
| 71c032c9dc | |||
| 66080d4abb | |||
| b1937e141c | |||
| 189731ef00 | |||
| e3c35ac635 | |||
| 8a69ba55a5 | |||
| 187a5efe81 | |||
| d488e4d987 | |||
| 20e81489be | |||
| 32c7754570 | |||
| 62903c46a1 | |||
| 64e0f66acb | |||
| fd1a667089 | |||
| ba5146cb8a | |||
| 83259d800c | |||
| 3a287949d3 | |||
| 3b443076f0 | |||
| 764796d276 | |||
| e177dc33cb | |||
| 711df4ed64 | |||
| 9d57878417 | |||
| 288264f9c9 | |||
| 7db63f5e7f | |||
| 00e5abe1c8 | |||
| 1b06a03d21 | |||
| 75d2e84710 | |||
| e482f7ce0f | |||
| d85452eadf | |||
| 01bd2b16cc | |||
| 966dfad385 | |||
| c57490a8b0 | |||
| aadc3a98df | |||
| c0084b0763 | |||
| 31c46541ce | |||
| 3d92e2fd55 | |||
| 7c4b9f1f99 | |||
| 7652d53369 | |||
| 3fa8fd6cee | |||
| 844f8735f6 | |||
| b1822b6abe | |||
| 4910870eaa | |||
| 16361eb4ac | |||
| 2eb0f86851 | |||
| 9a77c647c2 | |||
| 8da14cc542 | |||
| c0150f24bb | |||
| a2eba60698 | |||
| 831547a4b2 | |||
| bd5a5edf1b | |||
| 46553eae11 | |||
| 11bede66e7 | |||
| 808d10a6aa | |||
| 25736cc1c0 | |||
| 6ce18a799f | |||
| 4809af4bd4 | |||
| 3c69ee1612 | |||
| 2f2b8d32b9 | |||
| 7d27b3ca0d | |||
| 616b5f11b6 | |||
| 91a922ca60 | |||
| 8f469b17c3 | |||
| 26d3d6b656 | |||
| f90a73305c | |||
| dee39257f5 | |||
| be79927858 | |||
| b15a5c70d3 | |||
| 857689ab4c | |||
| b2630b1c8f | |||
| 0401e3b43f | |||
| a41bdb53bd | |||
| 550aee6c36 | |||
| ba23c24d3a | |||
| 333f75f372 | |||
| 1575f408ae | |||
| 3476bf7e65 | |||
| 008429aaab | |||
| 86a3c300c7 | |||
| 6eea37b1f9 | |||
| 21c525440c | |||
| 7d37d3a39a | |||
| 3bb386ec5a | |||
| a5a80db759 | |||
| cebd0015e0 | |||
| f93586ef6c | |||
| b911fb4dcf | |||
| c91cecd7e1 | |||
| 4083be1363 | |||
| 57272db01c | |||
| 239a50c280 | |||
| 5fa8f53e89 | |||
| 54f7007102 | |||
| 82ac7db7f2 | |||
| 781702ee9d | |||
| 068938ab22 | |||
| 19b5ac8979 | |||
| c1f39e2b46 | |||
| 5fb41c87da | |||
| 20d6724b2c | |||
| 903b94526d | |||
| 8d746f09e2 | |||
| 497618ba62 | |||
| 101470c99f | |||
| dead32d589 | |||
| ad8a667428 | |||
| 5d8b0b2005 | |||
| 6a16840a86 | |||
| 41a402c64b |
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jest/recommended"
|
||||
],
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2019
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
---
|
||||
name: User Support
|
||||
about: Questions for this Action
|
||||
title: 'sample_title'
|
||||
labels: support
|
||||
assignees: peaceiris
|
||||
---
|
||||
|
||||
**Note that an issue which does not follow the template will be closed silently.**
|
||||
|
||||
## Check list before opening this issue
|
||||
|
||||
- [ ] I read the latest README of this repository.
|
||||
|
||||
For users of the GitHub Pages Action:
|
||||
|
||||
- [ ] I checked [Available Options](https://github.com/peaceiris/actions-gh-pages#options)
|
||||
- [ ] I followed [Tips and FAQs](https://github.com/peaceiris/actions-gh-pages#tips-and-faq)
|
||||
- [ ] I tried [Workflow Examples](https://github.com/peaceiris/actions-gh-pages#examples)
|
||||
|
||||
## Describe your question
|
||||
|
||||
A clear and concise description of what the question is.
|
||||
|
||||
## Link to your contents
|
||||
|
||||
- Link to your public repository here
|
||||
- Link to your workflow here
|
||||
|
||||
## Screenshots
|
||||
|
||||
If applicable, add screenshots to help explain your question.
|
||||
|
||||
## Additional context
|
||||
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,52 @@
|
||||
name: User Support
|
||||
description: Questions for this action
|
||||
title: "support: "
|
||||
labels: support
|
||||
assignees: peaceiris
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value:
|
||||
Please note we will close your issue without comment if you do not fill out the issue checklist below and provide ALL the requested information.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Checklist before creating an issue.
|
||||
options:
|
||||
- label: "I am using the latest version of this action."
|
||||
required: true
|
||||
- label: "I have read the latest README and followed the instructions."
|
||||
required: true
|
||||
- label: "I have read the latest GitHub Actions official documentation and learned the basic spec and concepts."
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe your question
|
||||
description: A clear and concise description of what the question is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant links
|
||||
description:
|
||||
Links to your public repository, YAML config file, and YAML workflow file.
|
||||
Please use [a permanent link](https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/getting-permanent-links-to-files), not a default branch.
|
||||
render: markdown
|
||||
value: |
|
||||
Public repository:
|
||||
YAML config:
|
||||
YAML workflow:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Copy and paste any relevant log output here.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context.
|
||||
description: Write any other context about the question here.
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: First, use the User Support Issue Template
|
||||
title: 'sample_title'
|
||||
labels: bug
|
||||
assignees: peaceiris
|
||||
|
||||
---
|
||||
|
||||
**Note that an issue which does not follow the template will be closed silently.**
|
||||
|
||||
## Describe the bug
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## To Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Expected behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Screenshots
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## Your YAML file
|
||||
|
||||
- A link to your repository
|
||||
- A link to your YAML file
|
||||
|
||||
## Additional context
|
||||
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Bug Report
|
||||
description: Try the User Support Issue Template first.
|
||||
title: 'bug: '
|
||||
labels: bug
|
||||
assignees: peaceiris
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value:
|
||||
Please note we will close your issue without comment if you do not fill out the issue checklist below and provide ALL the requested information.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Checklist before creating an issue.
|
||||
options:
|
||||
- label: "I am using the latest version of this action."
|
||||
required: true
|
||||
- label: "I have read the latest README and followed the instructions."
|
||||
required: true
|
||||
- label: "I have read the latest GitHub Actions official documentation and learned the basic spec and concepts."
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Describe the bug"
|
||||
description: "A clear and concise description of what the bug is."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant links
|
||||
description:
|
||||
Links to your public repository, YAML config file, and YAML workflow file.
|
||||
Please use [a permanent link](https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/getting-permanent-links-to-files), not a default branch.
|
||||
render: markdown
|
||||
value: |
|
||||
Public repository:
|
||||
YAML config:
|
||||
YAML workflow:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Copy and paste any relevant log output here.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context.
|
||||
description: Write any other context about the question here.
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,26 +0,0 @@
|
||||
---
|
||||
name: Proposal
|
||||
about: Suggest an idea for this project
|
||||
title: 'sample_title'
|
||||
labels: proposal
|
||||
assignees: peaceiris
|
||||
|
||||
---
|
||||
|
||||
**Note that an issue which does not follow the template will be closed silently.**
|
||||
|
||||
## Is your feature request related to a problem? Please describe.
|
||||
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
## Describe the solution you'd like
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
## Describe alternatives you've considered
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
## Additional context
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,45 @@
|
||||
name: Proposal
|
||||
description: Suggest an idea for this project
|
||||
title: 'proposal: '
|
||||
labels: proposal
|
||||
assignees: peaceiris
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value:
|
||||
Please note we will close your issue without comment if you do not fill out the issue checklist below and provide ALL the requested information.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Checklist before creating an issue.
|
||||
options:
|
||||
- label: "I am using the latest version of this action."
|
||||
required: true
|
||||
- label: "I have read the latest README and followed the instructions."
|
||||
required: true
|
||||
- label: "I have read the latest GitHub Actions official documentation and learned the basic spec and concepts."
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Describe your proposal"
|
||||
description: "A clear and concise description of what the proposal is."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Describe the solution you'd like"
|
||||
description: "A clear and concise description of what you want to happen."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Describe alternatives you've considered"
|
||||
description: "A clear and concise description of any alternative solutions or features you've considered."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Additional context"
|
||||
description: "Add any other context or screenshots about the feature request here."
|
||||
validations:
|
||||
required: true
|
||||
@@ -7,5 +7,5 @@ contact_links:
|
||||
url: https://discourse.gohugo.io/
|
||||
about: Please ask questions about Hugo here.
|
||||
- name: GitHub Actions Documentation
|
||||
url: https://docs.github.com/en/free-pro-team@latest/actions
|
||||
url: https://docs.github.com/en/actions
|
||||
about: GitHub Actions official documentation here.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
## Summary
|
||||
|
||||
<!-- Describe what this pull request changes and why. -->
|
||||
|
||||
## Changes
|
||||
|
||||
<!-- List the notable changes. -->
|
||||
|
||||
-
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] I have read the latest README and followed the instructions.
|
||||
- [ ] I have added or updated tests for behavior changes.
|
||||
- [ ] I have updated README.md and action.yml when inputs or runtime behavior changed.
|
||||
- [ ] I have run the relevant verification commands.
|
||||
|
||||
## Verification
|
||||
|
||||
<!-- List the commands you ran and their results. -->
|
||||
|
||||
- [ ] `npm run all`
|
||||
- [ ] `npm run build`
|
||||
@@ -30,3 +30,14 @@ labels:
|
||||
labeled:
|
||||
issue:
|
||||
body: This issue is easy for contributing. Everyone can work on this.
|
||||
- name: resolved
|
||||
labeled:
|
||||
issue:
|
||||
body: |
|
||||
This issue has been **LOCKED** because of it being resolved!
|
||||
|
||||
The issue has been fixed and is therefore considered resolved.
|
||||
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.
|
||||
action: close
|
||||
locking: lock
|
||||
lock_reason: resolved
|
||||
|
||||
@@ -8,17 +8,21 @@ on:
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
||||
with:
|
||||
languages: javascript
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: github/codeql-action/autobuild@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Source repository: https://github.com/actions/dependency-review-action
|
||||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
||||
name: 'Dependency Review'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0
|
||||
@@ -23,9 +23,12 @@ on:
|
||||
|
||||
jobs:
|
||||
dev-image-test:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- run: make build
|
||||
- run: make cirun cmd="npm ci"
|
||||
# - run: make ciall
|
||||
|
||||
@@ -12,14 +12,18 @@ on:
|
||||
|
||||
jobs:
|
||||
comment:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- name: Label Commenter
|
||||
uses: peaceiris/actions-label-commenter@v1.9.1
|
||||
uses: peaceiris/actions-label-commenter@f0dbbef043eb1b150b566db36b0bdc8b7f505579 # v1.10.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# config_file: .github/label-commenter-config.yml
|
||||
|
||||
@@ -6,11 +6,12 @@ on:
|
||||
|
||||
jobs:
|
||||
purge:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-slim
|
||||
timeout-minutes: 5
|
||||
permissions: {}
|
||||
steps:
|
||||
|
||||
- run: >
|
||||
curl -sL https://github.com/${GITHUB_REPOSITORY} |
|
||||
grep -oE '<img src="https?://camo.githubusercontent.com/[^"]+' |
|
||||
sed -e 's/<img src="//' |
|
||||
xargs -I % curl -sX PURGE %
|
||||
- run: |
|
||||
curl -sL "https://github.com/${GITHUB_REPOSITORY}" |
|
||||
grep -oE '<img src="https?://camo.githubusercontent.com/[^"]+' |
|
||||
sed -e 's/<img src="//' |
|
||||
xargs -r -I % curl -sX PURGE %
|
||||
|
||||
@@ -7,9 +7,12 @@ on:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
|
||||
@@ -1,38 +1,29 @@
|
||||
name: Daily Test
|
||||
name: Test Action
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '13 13 * * *'
|
||||
push:
|
||||
branches: [main, feat/node24]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- 'ubuntu-20.04'
|
||||
- 'ubuntu-18.04'
|
||||
- 'macos-latest'
|
||||
- 'windows-latest'
|
||||
hugo-version:
|
||||
- 'latest'
|
||||
- '0.61.0'
|
||||
extended:
|
||||
- true
|
||||
- false
|
||||
hugo-version: ['latest', '0.160.1']
|
||||
extended: [true, false]
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2.4.13
|
||||
uses: peaceiris/actions-hugo@32c7754570a8edd0ae33352fae4a8448f23858e9 # v3.1.0
|
||||
with:
|
||||
hugo-version: ${{ matrix.hugo-version }}
|
||||
extended: ${{ matrix.extended }}
|
||||
|
||||
- name: Run hugo version
|
||||
run: echo "::set-output name=hugo_version::$(hugo version)"
|
||||
id: hugo_version
|
||||
|
||||
- name: '${{ steps.hugo_version.outputs.hugo_version }}'
|
||||
run: echo '${{ steps.hugo_version.outputs.hugo_version }}'
|
||||
- name: Verify Hugo
|
||||
run: hugo version
|
||||
|
||||
+14
-16
@@ -13,46 +13,44 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- 'ubuntu-20.04'
|
||||
- 'ubuntu-18.04'
|
||||
- 'ubuntu-24.04'
|
||||
- 'macos-latest'
|
||||
- 'windows-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Read .nvmrc
|
||||
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
||||
id: nvm
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2.1.5
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- run: npm i -g npm
|
||||
- run: npm ci
|
||||
|
||||
- name: Run prettier
|
||||
if: startsWith(matrix.os, 'ubuntu-18.04')
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: npm run format:check
|
||||
|
||||
- name: Run eslint
|
||||
if: startsWith(matrix.os, 'ubuntu-18.04')
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: npm run lint
|
||||
|
||||
- name: Run ncc
|
||||
if: startsWith(matrix.os, 'ubuntu-18.04')
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: npm run build
|
||||
|
||||
- run: npm test
|
||||
|
||||
- name: Upload test coverage as artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: coverage-${{ matrix.os }}
|
||||
path: coverage
|
||||
|
||||
- uses: codecov/codecov-action@v1.5.0
|
||||
- uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
|
||||
|
||||
@@ -2,22 +2,23 @@ name: Update major tag
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- name: Update major tag
|
||||
if: github.event.release.prerelease == false
|
||||
run: |
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
export TAG_NAME="${GITHUB_REF##refs/tags/}"
|
||||
export TAG_MAJOR="${TAG_NAME%%.*}"
|
||||
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
|
||||
git push --force origin "${TAG_MAJOR}"
|
||||
- name: Update major tag
|
||||
run: |
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
export TAG_NAME="${GITHUB_REF##refs/tags/}"
|
||||
export TAG_MAJOR="${TAG_NAME%%.*}"
|
||||
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
|
||||
git push --force origin "${TAG_MAJOR}"
|
||||
|
||||
@@ -4,3 +4,4 @@ coverage
|
||||
.eslintcache
|
||||
.env
|
||||
node_modules
|
||||
.codex/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Repository Guidelines
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
This repository contains a TypeScript GitHub Action for installing Hugo. Runtime source lives in `src/`, with `src/index.ts` as the action entry and `src/main.ts` coordinating input handling and installation. Tests live in `__tests__/`, with fixtures in `__tests__/data/`. The action metadata is `action.yml`; it points to the bundled output `lib/index.js`, which is generated by `npm run build`. Workflow automation is under `.github/workflows/`, and project imagery is in `images/`.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
- `npm ci`: install dependencies from `package-lock.json`.
|
||||
- `npm run all`: run format check, ESLint, and Jest tests; use this before opening a PR.
|
||||
- `npm test`: run Jest with coverage and verbose output.
|
||||
- `npm run lint` / `npm run lint:fix`: check or fix TypeScript lint issues.
|
||||
- `npm run format:check` / `npm run format`: check or apply Prettier formatting for `*.ts`.
|
||||
- `npm run build`: bundle `src/index.ts` into `lib/` with `ncc`; do not regenerate `lib/index.js` except for release work.
|
||||
- `make build`, `make test`, `make all`: run the Docker-based development image and test flow.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Use TypeScript with `strict` and `noImplicitAny` enabled. Follow the existing Prettier settings: 2-space indentation, single quotes, semicolons, 100-column print width, no trailing commas, and no bracket spacing. Use named exports for reusable helpers, keep filenames lowercase with hyphenated words such as `get-latest-version.ts`, and keep tests named `*.test.ts`. Makefiles use tabs, as defined in `.editorconfig`.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
Jest with `ts-jest` and `jest-circus` runs all `**/*.test.ts` files in a Node environment. Add focused unit tests next to related behavior in `__tests__/`, and place mocked API responses or reusable input data in `__tests__/data/`. Preserve or improve coverage when changing installer logic, URL generation, OS/arch detection, or latest-version lookup.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
Commit history follows short Conventional Commit-style prefixes such as `feat:`, `ci:`, and `docs:`. Keep commit subjects imperative and scoped to one change. PRs should describe the behavior change, mention linked issues when applicable, and list verification commands such as `npm run all` and `npm run build`. Include updates to `README.md`, `action.yml`, and tests whenever inputs, runtime behavior, or documented examples change.
|
||||
|
||||
## Agent-Specific Instructions
|
||||
|
||||
Use English for repository-facing content, including documentation, code comments, commit messages, and pull request text, unless the task explicitly requires another language.
|
||||
+180
@@ -2,6 +2,186 @@
|
||||
|
||||
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)
|
||||
|
||||
|
||||
### build
|
||||
|
||||
* update npm dependencies (#689) ([189731e](https://github.com/peaceiris/actions-hugo/commit/189731ef0083fa5500ca268865b02bd8eb3e7050)), closes [#689](https://github.com/peaceiris/actions-hugo/issues/689)
|
||||
|
||||
### chore
|
||||
|
||||
* delete lib/index.js ([8a69ba5](https://github.com/peaceiris/actions-hugo/commit/8a69ba55a596c78f65c6feef166e2eb2aebc2f2f))
|
||||
|
||||
### ci
|
||||
|
||||
* bump actions/checkout from 4.3.1 to 6.0.2 (#691) ([71c032c](https://github.com/peaceiris/actions-hugo/commit/71c032c9dcb44d6b93dd8910811cb1b6ea450bd5)), closes [#691](https://github.com/peaceiris/actions-hugo/issues/691)
|
||||
* bump actions/setup-node from 4.4.0 to 6.4.0 (#690) ([66080d4](https://github.com/peaceiris/actions-hugo/commit/66080d4abbf3e0d1bcfc83914cbbb18f90efcf00)), closes [#690](https://github.com/peaceiris/actions-hugo/issues/690) [actions/setup-node#1525](https://github.com/actions/setup-node/issues/1525) [actions/setup-node#1533](https://github.com/actions/setup-node/issues/1533) [actions/setup-node#1525](https://github.com/actions/setup-node/issues/1525) [actions/setup-node#1283](https://github.com/actions/setup-node/issues/1283) [actions/setup-node#1491](https://github.com/actions/setup-node/issues/1491) [actions/setup-node#1378](https://github.com/actions/setup-node/issues/1378) [actions/setup-node#1498](https://github.com/actions/setup-node/issues/1498) [actions/setup-node#1467](https://github.com/actions/setup-node/issues/1467) [actions/setup-node#1495](https://github.com/actions/setup-node/issues/1495) [actions/setup-node#1283](https://github.com/actions/setup-node/issues/1283) [actions/setup-node#1454](https://github.com/actions/setup-node/issues/1454) [actions/setup-node#1442](https://github.com/actions/setup-node/issues/1442) [actions/setup-node#1446](https://github.com/actions/setup-node/issues/1446) [actions/setup-node#1226](https://github.com/actions/setup-node/issues/1226) [actions/setup-node#1468](https://github.com/actions/setup-node/issues/1468) [actions/setup-node#1449](https://github.com/actions/setup-node/issues/1449) [actions/setup-node#1454](https://github.com/actions/setup-node/issues/1454) [actions/setup-node#1442](https://github.com/actions/setup-node/issues/1442) [actions/setup-node#1446](https://github.com/actions/setup-node/issues/1446) [#1533](https://github.com/peaceiris/actions-hugo/issues/1533) [#1525](https://github.com/peaceiris/actions-hugo/issues/1525) [#1498](https://github.com/peaceiris/actions-hugo/issues/1498) [#1495](https://github.com/peaceiris/actions-hugo/issues/1495) [#1378](https://github.com/peaceiris/actions-hugo/issues/1378) [#1283](https://github.com/peaceiris/actions-hugo/issues/1283) [#1467](https://github.com/peaceiris/actions-hugo/issues/1467) [#1491](https://github.com/peaceiris/actions-hugo/issues/1491) [#1468](https://github.com/peaceiris/actions-hugo/issues/1468) [#1226](https://github.com/peaceiris/actions-hugo/issues/1226)
|
||||
* bump actions/upload-artifact from 4.6.2 to 7.0.1 (#692) ([27f9d4a](https://github.com/peaceiris/actions-hugo/commit/27f9d4ab073f98ceaee353f893283fd6da81cb6d)), closes [#692](https://github.com/peaceiris/actions-hugo/issues/692)
|
||||
* bump github/codeql-action from 3.35.4 to 4.35.4 (#694) ([681f914](https://github.com/peaceiris/actions-hugo/commit/681f914d18cf3aefb972de7c4f1ac75dfff38e5d)), closes [#694](https://github.com/peaceiris/actions-hugo/issues/694)
|
||||
* bump peaceiris/actions-hugo from 3.0.0 to 3.1.0 (#693) ([7c673b8](https://github.com/peaceiris/actions-hugo/commit/7c673b8b9ebc5b359f3f4dd4eca150830f1fea5e)), closes [#693](https://github.com/peaceiris/actions-hugo/issues/693)
|
||||
|
||||
### docs
|
||||
|
||||
* add pull request template ([d488e4d](https://github.com/peaceiris/actions-hugo/commit/d488e4d9876f0cb74ace1aac7bbf14fcf52868d9))
|
||||
* document build artifact constraint ([e3c35ac](https://github.com/peaceiris/actions-hugo/commit/e3c35ac635d46e1fc932dd524c5490fff7d235a9))
|
||||
|
||||
### feat
|
||||
|
||||
* support renamed Hugo release assets (#687) ([187a5ef](https://github.com/peaceiris/actions-hugo/commit/187a5efe8178fbcd0f0969d3db97b33d4f89d8ab)), closes [#687](https://github.com/peaceiris/actions-hugo/issues/687)
|
||||
|
||||
### fix
|
||||
|
||||
* Hugo package naming fix (#688) ([b1937e1](https://github.com/peaceiris/actions-hugo/commit/b1937e141c2b829e9913293bb8044aec5ef28dd2)), closes [#688](https://github.com/peaceiris/actions-hugo/issues/688) [#609](https://github.com/peaceiris/actions-hugo/issues/609) [#687](https://github.com/peaceiris/actions-hugo/issues/687)
|
||||
|
||||
|
||||
|
||||
# [3.1.0](https://github.com/peaceiris/actions-hugo/compare/v3.0.0...v3.1.0) (2026-05-10)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* add .codex/ ([fd1a667](https://github.com/peaceiris/actions-hugo/commit/fd1a6670898ca2ebf1a2c7f921f3eaf59eb75878))
|
||||
|
||||
### ci
|
||||
|
||||
* bump actions/dependency-review-action from 3 to 4 (#656) ([711df4e](https://github.com/peaceiris/actions-hugo/commit/711df4ed6415b013fd3ce424f98c5720d36d19e0)), closes [#656](https://github.com/peaceiris/actions-hugo/issues/656)
|
||||
* bump actions/upload-artifact from 3 to 4 (#654) ([764796d](https://github.com/peaceiris/actions-hugo/commit/764796d276c5a0094764d3fb3fbc3bb6fefb19e6)), closes [#654](https://github.com/peaceiris/actions-hugo/issues/654)
|
||||
* bump codecov/codecov-action from 3 to 4 (#655) ([e177dc3](https://github.com/peaceiris/actions-hugo/commit/e177dc33cb0d5866aa77a82d4cdfdda3a5cd76a3)), closes [#655](https://github.com/peaceiris/actions-hugo/issues/655)
|
||||
* bump codecov/codecov-action from 4 to 5 (#660) ([3a28794](https://github.com/peaceiris/actions-hugo/commit/3a287949d38134f0920e6ac20032acef6d4a23c4)), closes [#660](https://github.com/peaceiris/actions-hugo/issues/660)
|
||||
* bump github/codeql-action from 2 to 3 (#657) ([9d57878](https://github.com/peaceiris/actions-hugo/commit/9d57878417d5429540d059b1dbf19e0717797912)), closes [#657](https://github.com/peaceiris/actions-hugo/issues/657)
|
||||
* bump peaceiris/actions-hugo from 2.6.0 to 3.0.0 (#653) ([3b44307](https://github.com/peaceiris/actions-hugo/commit/3b443076f02aa9537a31bdcaa0c971cdd41eb022)), closes [#653](https://github.com/peaceiris/actions-hugo/issues/653)
|
||||
* harden workflows and update Node.js (#686) ([64e0f66](https://github.com/peaceiris/actions-hugo/commit/64e0f66acbd8b134359e19b06e518ceb2734de14)), closes [#686](https://github.com/peaceiris/actions-hugo/issues/686)
|
||||
|
||||
### docs
|
||||
|
||||
* add contributor guidelines ([ba5146c](https://github.com/peaceiris/actions-hugo/commit/ba5146cb8a90074a91c351b17a4206ffd8594cd5))
|
||||
* add env.HUGO_CACHEDIR (#650) ([288264f](https://github.com/peaceiris/actions-hugo/commit/288264f9c9c4a54b634fdbfdc119faefe699d549)), closes [#650](https://github.com/peaceiris/actions-hugo/issues/650)
|
||||
* bump actions/cache to v4 ([7db63f5](https://github.com/peaceiris/actions-hugo/commit/7db63f5e7f65f5c06a64fd56106389606f84a976))
|
||||
|
||||
### feat
|
||||
|
||||
* upgrade action runtime from Node 20 to 24 (#684) ([83259d8](https://github.com/peaceiris/actions-hugo/commit/83259d800c0f56b05d14cb0b320d8e4034770d68)), closes [#684](https://github.com/peaceiris/actions-hugo/issues/684)
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* Convert templates to YAML issue forms ([5fb41c8](https://github.com/peaceiris/actions-hugo/commit/5fb41c87da82b4f59a6198b0752b2bca9078d4a4))
|
||||
* Fix prettier (#535) ([5fa8f53](https://github.com/peaceiris/actions-hugo/commit/5fa8f53e895b6475798170197409983ae10d261c)), closes [#535](https://github.com/peaceiris/actions-hugo/issues/535)
|
||||
* fix year (#613) ([8da14cc](https://github.com/peaceiris/actions-hugo/commit/8da14cc542424be0081be3474ad36c74e34a7dfe)), closes [#613](https://github.com/peaceiris/actions-hugo/issues/613)
|
||||
* update url ([c1f39e2](https://github.com/peaceiris/actions-hugo/commit/c1f39e2b46476a13ad7e4a5eb06b8e2f582a2f13))
|
||||
|
||||
### ci
|
||||
|
||||
* add actions/dependency-review-action v1 ([4809af4](https://github.com/peaceiris/actions-hugo/commit/4809af4bd48eabfbb4c6be7588a9b3859dba454a))
|
||||
* add resolved ([101470c](https://github.com/peaceiris/actions-hugo/commit/101470c99f5450d86c10ea44c549fd267b317ffc))
|
||||
* bump actions/checkout from 2.3.4 to 2.3.5 (#546) ([3bb386e](https://github.com/peaceiris/actions-hugo/commit/3bb386ec5a21d7ae895f0880b0a2fb1ea189cd8b)), closes [#546](https://github.com/peaceiris/actions-hugo/issues/546)
|
||||
* bump actions/checkout from 2.3.5 to 2.4.0 (#548) ([86a3c30](https://github.com/peaceiris/actions-hugo/commit/86a3c300c730f9c35886afeca0af0c2ce031b0b4)), closes [#548](https://github.com/peaceiris/actions-hugo/issues/548)
|
||||
* bump actions/checkout from 2.4.0 to 3 (#565) ([a41bdb5](https://github.com/peaceiris/actions-hugo/commit/a41bdb53bd93ff61a324fffa43fab5b65bca4fdd)), closes [#565](https://github.com/peaceiris/actions-hugo/issues/565)
|
||||
* bump actions/dependency-review-action from 1 to 2 (#593) ([831547a](https://github.com/peaceiris/actions-hugo/commit/831547a4b23e8d07bbc73bdcc8423938d344bb4a)), closes [#593](https://github.com/peaceiris/actions-hugo/issues/593)
|
||||
* bump actions/setup-node from 2.1.5 to 2.2.0 (#529) ([497618b](https://github.com/peaceiris/actions-hugo/commit/497618ba62018779773217131791215872b92631)), closes [#529](https://github.com/peaceiris/actions-hugo/issues/529)
|
||||
* bump actions/setup-node from 2.2.0 to 2.3.0 (#531) ([781702e](https://github.com/peaceiris/actions-hugo/commit/781702ee9d9be2f39d1cc7971dfde041e1b17e1b)), closes [#531](https://github.com/peaceiris/actions-hugo/issues/531)
|
||||
* bump actions/setup-node from 2.3.0 to 2.3.2 (#537) ([239a50c](https://github.com/peaceiris/actions-hugo/commit/239a50c280a0b6595f3fd9f60f17d34e290a3ae4)), closes [#537](https://github.com/peaceiris/actions-hugo/issues/537)
|
||||
* bump actions/setup-node from 2.3.2 to 2.4.0 (#538) ([57272db](https://github.com/peaceiris/actions-hugo/commit/57272db01ca4c3253e4bb6163664a50a23a76cc5)), closes [#538](https://github.com/peaceiris/actions-hugo/issues/538)
|
||||
* bump actions/setup-node from 2.4.0 to 2.4.1 (#543) ([cebd001](https://github.com/peaceiris/actions-hugo/commit/cebd0015e0fbf4cdcd17422a1ba70f0c13b8b5c4)), closes [#543](https://github.com/peaceiris/actions-hugo/issues/543)
|
||||
* bump actions/setup-node from 2.4.1 to 2.5.0 (#551) ([008429a](https://github.com/peaceiris/actions-hugo/commit/008429aaabf87bac670904f069d682b7493ef9e1)), closes [#551](https://github.com/peaceiris/actions-hugo/issues/551)
|
||||
* bump actions/setup-node from 2.5.0 to 2.5.1 (#552) ([1575f40](https://github.com/peaceiris/actions-hugo/commit/1575f408aee0a92b8b324e1d7537fac7316d69d0)), closes [#552](https://github.com/peaceiris/actions-hugo/issues/552)
|
||||
* bump actions/setup-node from 2.5.1 to 3.0.0 (#557) ([550aee6](https://github.com/peaceiris/actions-hugo/commit/550aee6c368724015b790edca76711b5b6c8e781)), closes [#557](https://github.com/peaceiris/actions-hugo/issues/557)
|
||||
* bump actions/setup-node from 3.0.0 to 3.1.0 (#574) ([2f2b8d3](https://github.com/peaceiris/actions-hugo/commit/2f2b8d32b92379b30f0a4ad74d0cd6472c42e482)), closes [#574](https://github.com/peaceiris/actions-hugo/issues/574)
|
||||
* bump actions/setup-node from 3.1.0 to 3.1.1 (#577) ([25736cc](https://github.com/peaceiris/actions-hugo/commit/25736cc1c02fdd4b3eae34d261d2ad7fe45e135a)), closes [#577](https://github.com/peaceiris/actions-hugo/issues/577)
|
||||
* bump actions/setup-node from 3.1.1 to 3.4.1 (#598) ([11bede6](https://github.com/peaceiris/actions-hugo/commit/11bede66e7d1c36c4e39a5d1e32442056e41e7ef)), closes [#598](https://github.com/peaceiris/actions-hugo/issues/598)
|
||||
* bump actions/setup-node from 3.4.1 to 3.5.0 (#606) ([a2eba60](https://github.com/peaceiris/actions-hugo/commit/a2eba606985f706c754c8e4c283bc3d913897a31)), closes [#606](https://github.com/peaceiris/actions-hugo/issues/606)
|
||||
* bump actions/setup-node from 3.5.0 to 3.5.1 (#612) ([c0150f2](https://github.com/peaceiris/actions-hugo/commit/c0150f24bb3e706c93def97a4dae60b9b6fd23ff)), closes [#612](https://github.com/peaceiris/actions-hugo/issues/612)
|
||||
* bump actions/upload-artifact from 2 to 3 (#576) ([6ce18a7](https://github.com/peaceiris/actions-hugo/commit/6ce18a799f48752081f8aff7bdc21e0757b9f260)), closes [#576](https://github.com/peaceiris/actions-hugo/issues/576)
|
||||
* bump codecov/codecov-action from 1.5.0 to 1.5.2 (#526) ([ad8a667](https://github.com/peaceiris/actions-hugo/commit/ad8a66742861fb836a13187e2d66d126c2758296)), closes [#526](https://github.com/peaceiris/actions-hugo/issues/526)
|
||||
* bump codecov/codecov-action from 1.5.2 to 2.0.1 (#530) ([19b5ac8](https://github.com/peaceiris/actions-hugo/commit/19b5ac8979b2b5edfe306c9f3659b98effd6e285)), closes [#530](https://github.com/peaceiris/actions-hugo/issues/530)
|
||||
* bump codecov/codecov-action from 2.0.1 to 2.0.2 (#533) ([54f7007](https://github.com/peaceiris/actions-hugo/commit/54f7007102553a5e97014fbcb91aea3c0920db0b)), closes [#533](https://github.com/peaceiris/actions-hugo/issues/533)
|
||||
* bump codecov/codecov-action from 2.0.2 to 2.0.3 (#540) ([b911fb4](https://github.com/peaceiris/actions-hugo/commit/b911fb4dcf324e9f66c0553f61e037bead654e5d)), closes [#540](https://github.com/peaceiris/actions-hugo/issues/540)
|
||||
* bump codecov/codecov-action from 2.0.3 to 2.1.0 (#542) ([f93586e](https://github.com/peaceiris/actions-hugo/commit/f93586ef6c1a3a4f26eb0b6117e732507466d4de)), closes [#542](https://github.com/peaceiris/actions-hugo/issues/542)
|
||||
* bump codecov/codecov-action from 2.1.0 to 3 (#575) ([3c69ee1](https://github.com/peaceiris/actions-hugo/commit/3c69ee16122614bd86d8881c92e1e374669ca559)), closes [#575](https://github.com/peaceiris/actions-hugo/issues/575)
|
||||
* bump github/codeql-action from 1 to 2 (#581) ([808d10a](https://github.com/peaceiris/actions-hugo/commit/808d10a6aac88104619e8d47fca8a56eaeb71b12)), closes [#581](https://github.com/peaceiris/actions-hugo/issues/581)
|
||||
* bump peaceiris/actions-hugo from 2.4.13 to 2.5.0 (#521) ([6a16840](https://github.com/peaceiris/actions-hugo/commit/6a16840a8614e1d75a22df38f4a7555e7bb623ea)), closes [#521](https://github.com/peaceiris/actions-hugo/issues/521)
|
||||
* bump peaceiris/actions-label-commenter from 1.9.1 to 1.9.2 (#528) ([dead32d](https://github.com/peaceiris/actions-hugo/commit/dead32d58922938cb063b358881eb7df21e5b228)), closes [#528](https://github.com/peaceiris/actions-hugo/issues/528)
|
||||
* bump peaceiris/actions-label-commenter from 1.9.2 to 1.10.0 (#532) ([82ac7db](https://github.com/peaceiris/actions-hugo/commit/82ac7db7f2d5ece5824b40882acb6c9dbd31da56)), closes [#532](https://github.com/peaceiris/actions-hugo/issues/532)
|
||||
* Change event from published to released ([5d8b0b2](https://github.com/peaceiris/actions-hugo/commit/5d8b0b2005c61de25aa469e038efb717902a8500))
|
||||
* drop ubuntu-18.04, add ubuntu-22.04 and ubuntu-latest (#603) ([bd5a5ed](https://github.com/peaceiris/actions-hugo/commit/bd5a5edf1b6a534bee1c70bd49f0ba3ff435e597)), closes [#603](https://github.com/peaceiris/actions-hugo/issues/603)
|
||||
* Remove updating npm ([ba23c24](https://github.com/peaceiris/actions-hugo/commit/ba23c24d3ae3be77ed05b3c0ac9990b030648de0))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @actions/core from 1.2.7 to 1.6.0 (#544) ([be79927](https://github.com/peaceiris/actions-hugo/commit/be79927858b2280c3c371f70e54a8f73fd17d931)), closes [#544](https://github.com/peaceiris/actions-hugo/issues/544)
|
||||
* bump @actions/exec from 1.0.4 to 1.1.1 (#571) ([7d27b3c](https://github.com/peaceiris/actions-hugo/commit/7d27b3ca0d7d3196371a1d3fb1575317d6099146)), closes [#571](https://github.com/peaceiris/actions-hugo/issues/571)
|
||||
* bump @actions/tool-cache from 1.6.1 to 1.7.2 (#570) ([616b5f1](https://github.com/peaceiris/actions-hugo/commit/616b5f11b689c6a3064f589815e8bfbc04c444e9)), closes [#570](https://github.com/peaceiris/actions-hugo/issues/570)
|
||||
* bump ansi-regex from 5.0.0 to 5.0.1 (#562) ([857689a](https://github.com/peaceiris/actions-hugo/commit/857689ab4c02dd173b4d9b2bc569b94f0bd56a11)), closes [#562](https://github.com/peaceiris/actions-hugo/issues/562)
|
||||
* bump glob-parent from 5.1.1 to 5.1.2 (#563) ([91a922c](https://github.com/peaceiris/actions-hugo/commit/91a922ca60edf9a5dd9466dae065fcbd8e02efc2)), closes [#563](https://github.com/peaceiris/actions-hugo/issues/563)
|
||||
* bump minimist from 1.2.5 to 1.2.6 (#572) ([b2630b1](https://github.com/peaceiris/actions-hugo/commit/b2630b1c8ff9200bde342ec33b98c1ede4c03473)), closes [#572](https://github.com/peaceiris/actions-hugo/issues/572)
|
||||
* bump path-parse from 1.0.6 to 1.0.7 (#559) ([dee3925](https://github.com/peaceiris/actions-hugo/commit/dee39257f51c6bfbeffdc8b475029fad02299a5a)), closes [#559](https://github.com/peaceiris/actions-hugo/issues/559)
|
||||
* bump shelljs from 0.8.4 to 0.8.5 (#561) ([26d3d6b](https://github.com/peaceiris/actions-hugo/commit/26d3d6b6560f1131c4f9ae9622a7558ac9a2c19d)), closes [#561](https://github.com/peaceiris/actions-hugo/issues/561)
|
||||
* bump tmpl from 1.0.4 to 1.0.5 (#558) ([8f469b1](https://github.com/peaceiris/actions-hugo/commit/8f469b17c39a96eeffd077531bf8db8b9f22e916)), closes [#558](https://github.com/peaceiris/actions-hugo/issues/558)
|
||||
* bump trim-off-newlines from 1.0.1 to 1.0.3 (#560) ([f90a733](https://github.com/peaceiris/actions-hugo/commit/f90a73305c9f1a235a04a6dd16b8d728f72c623c)), closes [#560](https://github.com/peaceiris/actions-hugo/issues/560)
|
||||
* bump ws from 7.4.0 to 7.5.7 (#573) ([b15a5c7](https://github.com/peaceiris/actions-hugo/commit/b15a5c70d3e8c52cb88b2cc6786611441c83e9d4)), closes [#573](https://github.com/peaceiris/actions-hugo/issues/573)
|
||||
* node 12.22.4 ([4083be1](https://github.com/peaceiris/actions-hugo/commit/4083be136338c4140b03cbe12fe046a46c38dbdd))
|
||||
|
||||
### docs
|
||||
|
||||
* Add concurrency ([8d746f0](https://github.com/peaceiris/actions-hugo/commit/8d746f09e2808a6e250393fde3d471d7cf53a047))
|
||||
* Improve concurrency usage ([20d6724](https://github.com/peaceiris/actions-hugo/commit/20d6724b2ce2fbb34442e0a950796050e21e054d))
|
||||
* Improve if syntax ([068938a](https://github.com/peaceiris/actions-hugo/commit/068938ab2245aee69d3120f8b120f009345713a8))
|
||||
* use setup-node cache-dependency-path (#602) ([46553ea](https://github.com/peaceiris/actions-hugo/commit/46553eae11dc4ca2d07de9f176dc4fa4c2c50c10)), closes [#602](https://github.com/peaceiris/actions-hugo/issues/602)
|
||||
* Use ubuntu-20.04 ([903b945](https://github.com/peaceiris/actions-hugo/commit/903b94526d6bc9980c3ed3de99ba63dad5209b10))
|
||||
|
||||
### feat
|
||||
|
||||
* bump node12 to node16 (#617) ([9a77c64](https://github.com/peaceiris/actions-hugo/commit/9a77c647c2a01d1de23ed40d01b9c80a00bffcd3)), closes [#617](https://github.com/peaceiris/actions-hugo/issues/617)
|
||||
|
||||
|
||||
|
||||
# [2.5.0](https://github.com/peaceiris/actions-hugo/compare/v2.4.13...v2.5.0) (2021-05-27)
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
ARG NODE_VERSION
|
||||
ARG NODE_VERSION=24.15.0
|
||||
|
||||
FROM node:${NODE_VERSION}-buster-slim
|
||||
FROM node:${NODE_VERSION}-bookworm-slim
|
||||
|
||||
SHELL ["/bin/bash", "-l", "-c"]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Shohei Ueda (peaceiris)
|
||||
Copyright (c) 2019 Shohei Ueda (peaceiris)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
|
||||
|
||||
[](https://www.repostatus.org/#active)
|
||||
[](https://github.com/peaceiris/actions-hugo/blob/main/LICENSE)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases/latest)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases)
|
||||
@@ -23,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.
|
||||
(A docker base action was taking about 1 min or more execution time to build and pull a docker image.)
|
||||
|
||||
| OS (runs-on) | ubuntu-18.04, ubuntu-20.04 | macos-latest | windows-2019 |
|
||||
| OS (runs-on) | ubuntu-latest, ubuntu-20.04, ubuntu-22.04 | macos-latest | windows-2019 |
|
||||
|---|:---:|:---:|:---:|
|
||||
| Support | ✅️ | ✅️ | ✅️ |
|
||||
|
||||
@@ -70,7 +71,7 @@ For the first deployment, we have to do this operation: [First Deployment with `
|
||||
[](https://github.com/peaceiris/actions-gh-pages)
|
||||
|
||||
```yaml
|
||||
name: github pages
|
||||
name: GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -80,17 +81,19 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true # Fetch Hugo themes (true OR recursive)
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.83.1'
|
||||
hugo-version: '0.119.0'
|
||||
# extended: true
|
||||
|
||||
- name: Build
|
||||
@@ -118,9 +121,9 @@ Set `extended: true` to use a Hugo extended version.
|
||||
|
||||
```yaml
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.83.1'
|
||||
hugo-version: '0.119.0'
|
||||
extended: true
|
||||
```
|
||||
|
||||
@@ -130,7 +133,7 @@ Set `hugo-version: 'latest'` to use the latest version of Hugo.
|
||||
|
||||
```yaml
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: 'latest'
|
||||
```
|
||||
@@ -148,12 +151,27 @@ This action fetches the latest version of Hugo by [hugo | Homebrew Formulae](htt
|
||||
### ⭐️ Caching Hugo Modules
|
||||
|
||||
Insert a cache step before site-building as follows.
|
||||
Note that the cache dir location of Hugo on a Linux-based operating system is `/tmp/hugo_cache`. On macOS, `${TMPDIR}/hugo_cache` has the location.
|
||||
|
||||
First, to maximize compatibility with all Hugo versions, let's define the variable `HUGO_CACHEDIR`:
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@v2
|
||||
# * ...
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
HUGO_CACHEDIR: /tmp/hugo_cache # <- Define the env variable here, so that Hugo's cache dir is now predictible in your workflow and doesn't depend on the Hugo's version you're using.
|
||||
|
||||
# * ...
|
||||
```
|
||||
|
||||
Now, let's add the cache action call just above the _Build_ step:
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/hugo_cache
|
||||
path: ${{ env.HUGO_CACHEDIR }} # <- Use the same env variable just right here
|
||||
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-hugomod-
|
||||
@@ -173,7 +191,7 @@ How to sync a Hugo version between a Docker Compose and a GitHub Actions workflo
|
||||
Write a `HUGO_VERSION` to the `.env` file like the following and push it to a remote branch.
|
||||
|
||||
```sh
|
||||
HUGO_VERSION=0.83.1
|
||||
HUGO_VERSION=0.119.0
|
||||
```
|
||||
|
||||
Next, add a step to read a Hugo version from the `.env` file.
|
||||
@@ -183,10 +201,10 @@ Next, add a step to read a Hugo version from the `.env` file.
|
||||
id: hugo-version
|
||||
run: |
|
||||
. ./.env
|
||||
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
|
||||
echo "HUGO_VERSION=${HUGO_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
|
||||
extended: true
|
||||
@@ -225,7 +243,7 @@ The alpine base Hugo Docker image is provided on the following repository.
|
||||
|
||||
Here is an example workflow for the [google/docsy] Hugo theme.
|
||||
This theme needs `autoprefixer` and `postcss-cli` to build a project.
|
||||
The following workflow is tested on [google/docsy-example].
|
||||
The following workflow is tested with [google/docsy-example].
|
||||
|
||||
[google/docsy]: https://github.com/google/docsy
|
||||
[google/docsy-example]: https://github.com/google/docsy-example
|
||||
@@ -233,48 +251,46 @@ The following workflow is tested on [google/docsy-example].
|
||||
A workflow for the Hugo Babel pipeline is also the same as follows.
|
||||
|
||||
```yaml
|
||||
name: github pages
|
||||
name: GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Set a branch to deploy
|
||||
- master # Set a branch to deploy
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@4
|
||||
with:
|
||||
submodules: recursive # Fetch the Docsy theme
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.83.1'
|
||||
hugo-version: '0.119.0'
|
||||
extended: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
# The action defaults to search for the dependency file (package-lock.json,
|
||||
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
|
||||
# hash as a part of the cache key.
|
||||
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
|
||||
cache-dependency-path: '**/package-lock.json'
|
||||
|
||||
- run: npm ci
|
||||
- run: hugo --minify
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
if: github.ref == 'refs/heads/main'
|
||||
if: github.ref == 'refs/heads/master'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@@ -288,7 +304,7 @@ jobs:
|
||||
Here is an example workflow for a Hugo project using `asciidoctor`.
|
||||
|
||||
```yaml
|
||||
name: github pages
|
||||
name: GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -298,23 +314,25 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true # Fetch Hugo themes (true OR recursive)
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.83.1'
|
||||
hugo-version: '0.119.0'
|
||||
extended: true
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
ruby-version: 3.2
|
||||
|
||||
- run: gem install asciidoctor
|
||||
|
||||
@@ -339,7 +357,7 @@ jobs:
|
||||
cf. [Gitinfo fails on unicode filename · Issue #3071 · gohugoio/hugo](https://github.com/gohugoio/hugo/issues/3071)
|
||||
|
||||
```yaml
|
||||
name: github pages
|
||||
name: GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -348,9 +366,11 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -358,9 +378,9 @@ jobs:
|
||||
run: git config core.quotePath false
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.83.1'
|
||||
hugo-version: '0.119.0'
|
||||
```
|
||||
|
||||
<div align="right">
|
||||
|
||||
+130
-10
@@ -1,15 +1,135 @@
|
||||
import getArch from '../src/get-arch';
|
||||
|
||||
describe('getArch', () => {
|
||||
test('processor architecture', () => {
|
||||
expect(getArch('x64')).toBe('64bit');
|
||||
expect(getArch('arm')).toBe('ARM');
|
||||
expect(getArch('arm64')).toBe('ARM64');
|
||||
});
|
||||
const groups = [
|
||||
{
|
||||
condition: 'when hugo version < 0.102.0',
|
||||
conventions: {
|
||||
arch: {
|
||||
darwinUniversal: false,
|
||||
droppedWindowsArmSupport: false,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
downcasedAll: false
|
||||
}
|
||||
},
|
||||
tests: [
|
||||
{arch: 'x64', os: 'linux', expected: '64bit'},
|
||||
{arch: 'x64', os: 'darwin', expected: '64bit'},
|
||||
{arch: 'x64', os: 'macOS', expected: '64bit'},
|
||||
{arch: 'x64', os: 'windows', expected: '64bit'},
|
||||
{arch: 'arm', os: 'linux', expected: 'ARM'},
|
||||
{arch: 'arm', os: 'darwin', expected: 'ARM'},
|
||||
{arch: 'arm', os: 'macOS', expected: 'ARM'},
|
||||
{arch: 'arm', os: 'windows', expected: 'ARM'},
|
||||
{arch: 'arm64', os: 'linux', expected: 'ARM64'},
|
||||
{arch: 'arm64', os: 'darwin', 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,
|
||||
droppedWindowsArmSupport: true,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
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', expected: 'ARM'},
|
||||
{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,
|
||||
droppedWindowsArmSupport: 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', expected: 'arm'},
|
||||
{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,
|
||||
droppedWindowsArmSupport: false,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
downcasedAll: false
|
||||
}
|
||||
},
|
||||
tests: [{arch: 'mips', os: 'linux', throws: true}]
|
||||
}
|
||||
];
|
||||
|
||||
test('exception', () => {
|
||||
expect(() => {
|
||||
getArch('mips');
|
||||
}).toThrowError('mips is not supported');
|
||||
});
|
||||
const passingTests = groups.flatMap(group =>
|
||||
group.tests
|
||||
.filter(example => !example.throws)
|
||||
.map(example => ({
|
||||
...example,
|
||||
condition: group.condition,
|
||||
conventions: group.conventions
|
||||
}))
|
||||
);
|
||||
|
||||
const throwingTests = groups.flatMap(group =>
|
||||
group.tests
|
||||
.filter(example => example.throws)
|
||||
.map(example => ({
|
||||
...example,
|
||||
condition: group.condition,
|
||||
conventions: group.conventions
|
||||
}))
|
||||
);
|
||||
|
||||
test.each(passingTests)(
|
||||
'$condition: $os on $arch returns $expected',
|
||||
({arch, os, conventions, expected}) => {
|
||||
expect(getArch(arch, os, conventions)).toBe(expected);
|
||||
}
|
||||
);
|
||||
|
||||
test.each(throwingTests)(
|
||||
'$condition: $os on $arch throws as not supported',
|
||||
({arch, os, conventions}) => {
|
||||
expect(() => {
|
||||
getArch(arch, os, conventions);
|
||||
}).toThrow(`${arch} is not supported`);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
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,
|
||||
droppedWindowsArmSupport: false,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
downcasedAll: false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
condition: 'when hugo version === 0.102.z',
|
||||
version: '0.102.0',
|
||||
expected: {
|
||||
arch: {
|
||||
darwinUniversal: true,
|
||||
droppedWindowsArmSupport: true,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
downcasedAll: false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
condition: 'when hugo version >= 0.103.0',
|
||||
version: '0.103.0',
|
||||
expected: {
|
||||
arch: {
|
||||
darwinUniversal: true,
|
||||
droppedWindowsArmSupport: 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,6 +1,6 @@
|
||||
import {getURL, getLatestVersion} from '../src/get-latest-version';
|
||||
import nock from 'nock';
|
||||
import {FetchError} from 'node-fetch';
|
||||
import {clearMockFetchResponses, mockFetchResponse} from './mocks/node-fetch';
|
||||
import {Tool} from '../src/constants';
|
||||
import jsonTestBrew from './data/brew.json';
|
||||
import jsonTestGithub from './data/github.json';
|
||||
@@ -10,7 +10,7 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
nock.cleanAll();
|
||||
clearMockFetchResponses();
|
||||
});
|
||||
|
||||
describe('getURL()', () => {
|
||||
@@ -27,24 +27,26 @@ describe('getURL()', () => {
|
||||
|
||||
describe('getLatestVersion()', () => {
|
||||
test('return latest version via brew', async () => {
|
||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||
mockFetchResponse(`https://formulae.brew.sh/api/formula/${Tool.Repo}.json`, 200, jsonTestBrew);
|
||||
|
||||
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
||||
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
||||
});
|
||||
|
||||
test('return latest version via GitHub', async () => {
|
||||
nock('https://api.github.com')
|
||||
.get(`/repos/${Tool.Org}/${Tool.Repo}/releases/latest`)
|
||||
.reply(200, jsonTestGithub);
|
||||
mockFetchResponse(
|
||||
`https://api.github.com/repos/${Tool.Org}/${Tool.Repo}/releases/latest`,
|
||||
200,
|
||||
jsonTestGithub
|
||||
);
|
||||
|
||||
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'github');
|
||||
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
||||
});
|
||||
|
||||
test('return exception 404', async () => {
|
||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
||||
mockFetchResponse(`https://formulae.brew.sh/api/formula/${Tool.Repo}.json`, 404);
|
||||
|
||||
await expect(getLatestVersion(Tool.Org, Tool.Repo, 'brew')).rejects.toThrowError(FetchError);
|
||||
await expect(getLatestVersion(Tool.Org, Tool.Repo, 'brew')).rejects.toThrow(FetchError);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,15 +1,100 @@
|
||||
import getOS from '../src/get-os';
|
||||
|
||||
describe('getOS', () => {
|
||||
test('os type', () => {
|
||||
expect(getOS('linux')).toBe('Linux');
|
||||
expect(getOS('darwin')).toBe('macOS');
|
||||
expect(getOS('win32')).toBe('Windows');
|
||||
const groups = [
|
||||
{
|
||||
condition: 'when hugo version < 0.102.0',
|
||||
conventions: {
|
||||
arch: {
|
||||
darwinUniversal: false,
|
||||
droppedWindowsArmSupport: 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,
|
||||
droppedWindowsArmSupport: true,
|
||||
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.103.0',
|
||||
conventions: {
|
||||
arch: {
|
||||
darwinUniversal: true,
|
||||
droppedWindowsArmSupport: 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', () => {
|
||||
const conventions = {
|
||||
arch: {
|
||||
darwinUniversal: false,
|
||||
droppedWindowsArmSupport: false,
|
||||
standardizedNaming: false
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: false,
|
||||
downcasedAll: false
|
||||
}
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
getOS('centos');
|
||||
}).toThrowError('centos is not supported');
|
||||
getOS('centos', conventions);
|
||||
}).toThrow('centos is not supported');
|
||||
});
|
||||
});
|
||||
|
||||
+156
-15
@@ -1,20 +1,161 @@
|
||||
import getURL from '../src/get-url';
|
||||
import getURL, {getDownloadVersion} from '../src/get-url';
|
||||
|
||||
describe('getURL()', () => {
|
||||
test('get a URL to an asset for each platform', () => {
|
||||
test('get URLs to Linux assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
||||
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
||||
const urlMacOSExtended = `${baseURL}/hugo_extended_0.58.2_macOS-64bit.tar.gz`;
|
||||
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
||||
expect(getURL('Linux', '64bit', 'false', '0.58.2')).toBe(urlLinux);
|
||||
expect(getURL('Linux', '64bit', 'true', '0.58.2')).not.toBe(urlLinux);
|
||||
expect(getURL('MyOS', '64bit', 'false', '0.58.2')).not.toBe(urlLinux);
|
||||
expect(getURL('Linux', '64bit', 'false', '0.58.1')).not.toBe(urlLinux);
|
||||
expect(getURL('Linux', '64bit', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
||||
expect(getURL('macOS', '64bit', 'false', '0.58.2')).toBe(urlMacOS);
|
||||
expect(getURL('macOS', '64bit', 'true', '0.58.2')).toBe(urlMacOSExtended);
|
||||
expect(getURL('Windows', '64bit', 'false', '0.58.2')).toBe(urlWindows);
|
||||
expect(getURL('Linux', '64bit', 'false', '0.58.2')).toEqual([
|
||||
`${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_0.58.2_Linux_64bit.tar.gz`,
|
||||
`${baseURL}/hugo_0.58.2_linux-amd64.tar.gz`,
|
||||
`${baseURL}/hugo_v0.58.2_Linux-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_v0.58.2_Linux_64bit.tar.gz`,
|
||||
`${baseURL}/hugo_v0.58.2_linux-amd64.tar.gz`
|
||||
]);
|
||||
expect(getURL('Linux', 'ARM64', 'true', '0.58.2')).toEqual([
|
||||
`${baseURL}/hugo_extended_0.58.2_Linux-ARM64.tar.gz`,
|
||||
`${baseURL}/hugo_extended_0.58.2_Linux_ARM64.tar.gz`,
|
||||
`${baseURL}/hugo_extended_0.58.2_linux-arm64.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.58.2_Linux-ARM64.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.58.2_Linux_ARM64.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.58.2_linux-arm64.tar.gz`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to legacy Linux assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.20.3';
|
||||
expect(getURL('Linux', '64bit', 'false', '0.20.3')).toEqual([
|
||||
`${baseURL}/hugo_0.20.3_Linux-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_0.20.3_Linux_64bit.tar.gz`,
|
||||
`${baseURL}/hugo_0.20.3_linux-amd64.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.3_Linux-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.3_Linux_64bit.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.3_linux-amd64.tar.gz`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to macOS assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.161.1';
|
||||
expect(getURL('macOS', '64bit', 'true', '0.161.1')).toEqual([
|
||||
`${baseURL}/hugo_extended_0.161.1_macOS-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_extended_0.161.1_macOS-64bit.zip`,
|
||||
`${baseURL}/hugo_extended_0.161.1_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_extended_0.161.1_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_extended_0.161.1_darwin-universal.pkg`,
|
||||
`${baseURL}/hugo_extended_v0.161.1_macOS-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.161.1_macOS-64bit.zip`,
|
||||
`${baseURL}/hugo_extended_v0.161.1_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.161.1_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_extended_v0.161.1_darwin-universal.pkg`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to macOS 0.102 universal assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.102.0';
|
||||
expect(getURL('macOS', 'universal', 'false', '0.102.0')).toEqual([
|
||||
`${baseURL}/hugo_0.102.0_macOS-universal.tar.gz`,
|
||||
`${baseURL}/hugo_0.102.0_macOS-universal.zip`,
|
||||
`${baseURL}/hugo_0.102.0_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_0.102.0_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_0.102.0_darwin-universal.pkg`,
|
||||
`${baseURL}/hugo_v0.102.0_macOS-universal.tar.gz`,
|
||||
`${baseURL}/hugo_v0.102.0_macOS-universal.zip`,
|
||||
`${baseURL}/hugo_v0.102.0_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_v0.102.0_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_v0.102.0_darwin-universal.pkg`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to darwin assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.103.0';
|
||||
expect(getURL('darwin', 'universal', 'false', '0.103.0')).toEqual([
|
||||
`${baseURL}/hugo_0.103.0_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_0.103.0_darwin-universal.pkg`,
|
||||
`${baseURL}/hugo_v0.103.0_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_v0.103.0_darwin-universal.pkg`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to legacy macOS assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.20.2';
|
||||
expect(getURL('macOS', '64bit', 'false', '0.20.2')).toEqual([
|
||||
`${baseURL}/hugo_0.20.2_macOS-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_0.20.2_macOS-64bit.zip`,
|
||||
`${baseURL}/hugo_0.20.2_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_0.20.2_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_0.20.2_darwin-universal.pkg`,
|
||||
`${baseURL}/hugo_v0.20.2_macOS-64bit.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.2_macOS-64bit.zip`,
|
||||
`${baseURL}/hugo_v0.20.2_macOS-all.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.2_darwin-universal.tar.gz`,
|
||||
`${baseURL}/hugo_v0.20.2_darwin-universal.pkg`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to Windows assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
||||
expect(getURL('Windows', '64bit', 'false', '0.58.2')).toEqual([
|
||||
`${baseURL}/hugo_0.58.2_Windows-64bit.zip`,
|
||||
`${baseURL}/hugo_0.58.2_windows-amd64.zip`,
|
||||
`${baseURL}/hugo_v0.58.2_Windows-64bit.zip`,
|
||||
`${baseURL}/hugo_v0.58.2_windows-amd64.zip`
|
||||
]);
|
||||
expect(getURL('Windows', 'ARM64', 'true', '0.58.2')).toEqual([
|
||||
`${baseURL}/hugo_extended_0.58.2_Windows-ARM64.zip`,
|
||||
`${baseURL}/hugo_extended_0.58.2_windows-arm64.zip`,
|
||||
`${baseURL}/hugo_extended_v0.58.2_Windows-ARM64.zip`,
|
||||
`${baseURL}/hugo_extended_v0.58.2_windows-arm64.zip`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to downcased Windows assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.103.0';
|
||||
expect(getURL('windows', 'amd64', 'false', '0.103.0')).toEqual([
|
||||
`${baseURL}/hugo_0.103.0_windows-amd64.zip`,
|
||||
`${baseURL}/hugo_0.103.0_Windows-amd64.zip`,
|
||||
`${baseURL}/hugo_v0.103.0_windows-amd64.zip`,
|
||||
`${baseURL}/hugo_v0.103.0_Windows-amd64.zip`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to legacy Windows assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.20.3';
|
||||
expect(getURL('Windows', '64bit', 'false', '0.20.3')).toEqual([
|
||||
`${baseURL}/hugo_0.20.3_Windows-64bit.zip`,
|
||||
`${baseURL}/hugo_0.20.3_windows-amd64.zip`,
|
||||
`${baseURL}/hugo_v0.20.3_Windows-64bit.zip`,
|
||||
`${baseURL}/hugo_v0.20.3_windows-amd64.zip`
|
||||
]);
|
||||
});
|
||||
|
||||
test('get URLs to downcased Linux assets', () => {
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.103.0';
|
||||
expect(getURL('linux', 'arm', 'false', '0.103.0')).toEqual([
|
||||
`${baseURL}/hugo_0.103.0_linux-arm.tar.gz`,
|
||||
`${baseURL}/hugo_0.103.0_Linux-arm.tar.gz`,
|
||||
`${baseURL}/hugo_0.103.0_Linux_arm.tar.gz`,
|
||||
`${baseURL}/hugo_v0.103.0_linux-arm.tar.gz`,
|
||||
`${baseURL}/hugo_v0.103.0_Linux-arm.tar.gz`,
|
||||
`${baseURL}/hugo_v0.103.0_Linux_arm.tar.gz`
|
||||
]);
|
||||
});
|
||||
|
||||
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([
|
||||
`${baseURL}/hugo_0.58.2_MyOS-64bit.tar.gz`
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as io from '@actions/io';
|
||||
import * as exec from '@actions/exec';
|
||||
import path from 'path';
|
||||
import {downloadHugoAsset, extractHugoAsset, isWindowsAsset} from '../src/installer';
|
||||
|
||||
jest.mock('@actions/tool-cache', () => ({
|
||||
downloadTool: jest.fn(),
|
||||
extractTar: jest.fn(),
|
||||
extractZip: jest.fn()
|
||||
}));
|
||||
|
||||
jest.mock('@actions/io', () => ({
|
||||
mv: jest.fn()
|
||||
}));
|
||||
|
||||
jest.mock('@actions/exec', () => ({
|
||||
exec: jest.fn()
|
||||
}));
|
||||
|
||||
describe('downloadHugoAsset()', () => {
|
||||
const mockedTC = tc as jest.Mocked<typeof tc>;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('retry 404 candidates and return the first downloaded asset', async () => {
|
||||
mockedTC.downloadTool
|
||||
.mockRejectedValueOnce(new Error('Unexpected HTTP response: 404'))
|
||||
.mockResolvedValueOnce('/tmp/hugo');
|
||||
|
||||
const result = await downloadHugoAsset([
|
||||
'https://example.com/missing.tar.gz',
|
||||
'https://example.com/hugo.tar.gz'
|
||||
]);
|
||||
|
||||
expect(result).toEqual({
|
||||
path: '/tmp/hugo',
|
||||
url: 'https://example.com/hugo.tar.gz'
|
||||
});
|
||||
expect(mockedTC.downloadTool).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
test('throw a clear error when all candidates return 404', async () => {
|
||||
mockedTC.downloadTool.mockRejectedValue(new Error('Unexpected HTTP response: 404'));
|
||||
|
||||
await expect(
|
||||
downloadHugoAsset([
|
||||
'https://example.com/missing-1.tar.gz',
|
||||
'https://example.com/missing-2.tar.gz'
|
||||
])
|
||||
).rejects.toThrow('Unable to find a compatible Hugo release asset');
|
||||
});
|
||||
|
||||
test('rethrow non-404 download failures without retrying', async () => {
|
||||
const error = new Error('socket hang up');
|
||||
mockedTC.downloadTool.mockRejectedValueOnce(error);
|
||||
|
||||
await expect(
|
||||
downloadHugoAsset(['https://example.com/hugo.tar.gz', 'https://example.com/fallback.tar.gz'])
|
||||
).rejects.toBe(error);
|
||||
expect(mockedTC.downloadTool).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('extractHugoAsset()', () => {
|
||||
const mockedTC = tc as jest.Mocked<typeof tc>;
|
||||
const mockedIO = io as jest.Mocked<typeof io>;
|
||||
const mockedExec = exec as jest.Mocked<typeof exec>;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('extract a tar.gz asset', async () => {
|
||||
mockedTC.extractTar.mockResolvedValue('/tmp/extracted');
|
||||
|
||||
await extractHugoAsset('/tmp/tool', 'https://example.com/hugo.tar.gz', '/tmp/temp', '/tmp/bin');
|
||||
|
||||
expect(mockedTC.extractTar).toHaveBeenCalledWith('/tmp/tool', '/tmp/temp');
|
||||
expect(mockedIO.mv).toHaveBeenCalledWith(path.join('/tmp/extracted', 'hugo'), '/tmp/bin');
|
||||
});
|
||||
|
||||
test('extract a zip asset', async () => {
|
||||
mockedTC.extractZip.mockResolvedValue('/tmp/extracted');
|
||||
|
||||
await extractHugoAsset(
|
||||
'/tmp/tool',
|
||||
'https://example.com/hugo_0.58.2_Windows-64bit.zip',
|
||||
'/tmp/temp',
|
||||
'/tmp/bin'
|
||||
);
|
||||
|
||||
expect(mockedTC.extractZip).toHaveBeenCalledWith('/tmp/tool', '/tmp/temp');
|
||||
expect(mockedIO.mv).toHaveBeenCalledWith(path.join('/tmp/extracted', 'hugo.exe'), '/tmp/bin');
|
||||
});
|
||||
|
||||
test('extract a macOS zip asset', async () => {
|
||||
mockedTC.extractZip.mockResolvedValue('/tmp/extracted');
|
||||
|
||||
await extractHugoAsset(
|
||||
'/tmp/tool',
|
||||
'https://example.com/hugo_0.20.2_macOS-64bit.zip',
|
||||
'/tmp/temp',
|
||||
'/tmp/bin'
|
||||
);
|
||||
|
||||
expect(mockedTC.extractZip).toHaveBeenCalledWith('/tmp/tool', '/tmp/temp');
|
||||
expect(mockedIO.mv).toHaveBeenCalledWith(path.join('/tmp/extracted', 'hugo'), '/tmp/bin');
|
||||
});
|
||||
|
||||
test('extract a macOS pkg asset', async () => {
|
||||
mockedExec.exec.mockResolvedValue(0);
|
||||
|
||||
await extractHugoAsset('/tmp/tool', 'https://example.com/hugo.pkg', '/tmp/temp', '/tmp/bin');
|
||||
|
||||
expect(mockedExec.exec).toHaveBeenCalledWith('pkgutil', [
|
||||
'--expand-full',
|
||||
'/tmp/tool',
|
||||
path.join('/tmp/temp', 'pkg')
|
||||
]);
|
||||
expect(mockedIO.mv).toHaveBeenCalledWith(
|
||||
path.join('/tmp/temp', 'pkg', 'Payload', 'hugo'),
|
||||
'/tmp/bin'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isWindowsAsset()', () => {
|
||||
test('detect Windows asset URLs', () => {
|
||||
expect(isWindowsAsset('https://example.com/hugo_0.58.2_Windows-64bit.zip')).toBe(true);
|
||||
expect(isWindowsAsset('https://example.com/hugo_0.119.0_windows-amd64.zip')).toBe(true);
|
||||
expect(isWindowsAsset('https://example.com/hugo_0.20.2_macOS-64bit.zip')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as main from '../src/main';
|
||||
import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
import nock from 'nock';
|
||||
import {Tool, Action} from '../src/constants';
|
||||
import {FetchError} from 'node-fetch';
|
||||
import {clearMockFetchResponses, mockFetchResponse} from './mocks/node-fetch';
|
||||
import jsonTestBrew from './data/brew.json';
|
||||
// import jsonTestGithub from './data/github.json';
|
||||
|
||||
@@ -19,7 +19,8 @@ describe('Integration testing run()', () => {
|
||||
await io.rmRF(workDir);
|
||||
|
||||
delete process.env['INPUT_HUGO-VERSION'];
|
||||
nock.cleanAll();
|
||||
delete process.env['INPUT_EXTENDED'];
|
||||
clearMockFetchResponses();
|
||||
});
|
||||
|
||||
test('succeed in installing a custom version', async () => {
|
||||
@@ -43,7 +44,7 @@ describe('Integration testing run()', () => {
|
||||
test('succeed in installing the latest version', async () => {
|
||||
const testVersion = 'latest';
|
||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||
mockFetchResponse(`https://formulae.brew.sh/api/formula/${Tool.Repo}.json`, 200, jsonTestBrew);
|
||||
const result: main.ActionResult = await main.run();
|
||||
expect(result.exitcode).toBe(0);
|
||||
expect(result.output).toMatch(`hugo v${Tool.TestVersionLatest}`);
|
||||
@@ -53,7 +54,7 @@ describe('Integration testing run()', () => {
|
||||
const testVersion = 'latest';
|
||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||
process.env['INPUT_EXTENDED'] = 'true';
|
||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||
mockFetchResponse(`https://formulae.brew.sh/api/formula/${Tool.Repo}.json`, 200, jsonTestBrew);
|
||||
const result: main.ActionResult = await main.run();
|
||||
expect(result.exitcode).toBe(0);
|
||||
expect(result.output).toMatch(`hugo v${Tool.TestVersionLatest}`);
|
||||
@@ -62,9 +63,9 @@ describe('Integration testing run()', () => {
|
||||
|
||||
test('fail to install the latest version due to 404 of brew', async () => {
|
||||
process.env['INPUT_HUGO-VERSION'] = 'latest';
|
||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
||||
mockFetchResponse(`https://formulae.brew.sh/api/formula/${Tool.Repo}.json`, 404);
|
||||
|
||||
await expect(main.run()).rejects.toThrowError(FetchError);
|
||||
await expect(main.run()).rejects.toThrow(FetchError);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,6 +82,6 @@ describe('showVersion()', () => {
|
||||
});
|
||||
|
||||
test('return not found', async () => {
|
||||
await expect(main.showVersion('gitgit', ['--version'])).rejects.toThrowError(Error);
|
||||
await expect(main.showVersion('gitgit', ['--version'])).rejects.toThrow('spawn gitgit ENOENT');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import path from 'path';
|
||||
|
||||
export function getInput(name: string): string {
|
||||
return process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||
}
|
||||
|
||||
export function addPath(inputPath: string): void {
|
||||
process.env.PATH = `${inputPath}${path.delimiter}${process.env.PATH || ''}`;
|
||||
}
|
||||
|
||||
export function debug(message: string): void {
|
||||
void message;
|
||||
}
|
||||
|
||||
export function info(message: string): void {
|
||||
void message;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import {spawn} from 'child_process';
|
||||
|
||||
interface ExecOptions {
|
||||
listeners?: {
|
||||
stdout?: (data: Buffer) => void;
|
||||
stderr?: (data: Buffer) => void;
|
||||
};
|
||||
}
|
||||
|
||||
export async function exec(
|
||||
commandLine: string,
|
||||
args: string[] = [],
|
||||
options: ExecOptions = {}
|
||||
): Promise<number> {
|
||||
if (commandLine === 'hugo') {
|
||||
const version = process.env.TEST_HUGO_VERSION || '';
|
||||
const extended = process.env.TEST_HUGO_EXTENDED === 'true' ? ' extended' : '';
|
||||
options.listeners?.stdout?.(Buffer.from(`hugo v${version}${extended}\n`));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(commandLine, args);
|
||||
|
||||
child.stdout?.on('data', (data: Buffer) => {
|
||||
options.listeners?.stdout?.(data);
|
||||
});
|
||||
child.stderr?.on('data', (data: Buffer) => {
|
||||
options.listeners?.stderr?.(data);
|
||||
});
|
||||
child.on('error', reject);
|
||||
child.on('close', code => {
|
||||
resolve(code ?? 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
export async function mkdirP(dir: string): Promise<void> {
|
||||
void dir;
|
||||
}
|
||||
|
||||
export async function rmRF(target: string): Promise<void> {
|
||||
void target;
|
||||
}
|
||||
|
||||
export async function mv(source: string, dest: string): Promise<void> {
|
||||
void source;
|
||||
void dest;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export async function downloadTool(url: string): Promise<string> {
|
||||
const version = /hugo(?:_extended)?_([^_]+)_/.exec(url)?.[1] || '';
|
||||
process.env.TEST_HUGO_VERSION = version;
|
||||
process.env.TEST_HUGO_EXTENDED = url.includes('hugo_extended_') ? 'true' : 'false';
|
||||
return '/tmp/hugo-archive';
|
||||
}
|
||||
|
||||
export async function extractTar(assetPath: string, tempDir: string): Promise<string> {
|
||||
void assetPath;
|
||||
void tempDir;
|
||||
return '/tmp/extracted';
|
||||
}
|
||||
|
||||
export async function extractZip(assetPath: string, tempDir: string): Promise<string> {
|
||||
void assetPath;
|
||||
void tempDir;
|
||||
return '/tmp/extracted';
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
|
||||
export class FetchError extends Error {
|
||||
name = 'FetchError' as const;
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
public type: string,
|
||||
systemError?: Record<string, unknown>
|
||||
) {
|
||||
super(message);
|
||||
if (systemError) {
|
||||
Object.assign(this, systemError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface ResponseLike {
|
||||
ok: boolean;
|
||||
status: number;
|
||||
json: () => Promise<unknown>;
|
||||
}
|
||||
|
||||
interface MockResponse {
|
||||
body?: unknown;
|
||||
status: number;
|
||||
}
|
||||
|
||||
const mockResponses = new Map<string, MockResponse>();
|
||||
|
||||
export function mockFetchResponse(url: string, status: number, body?: unknown): void {
|
||||
mockResponses.set(url, {
|
||||
body,
|
||||
status
|
||||
});
|
||||
}
|
||||
|
||||
export function clearMockFetchResponses(): void {
|
||||
mockResponses.clear();
|
||||
}
|
||||
|
||||
export default async function fetch(url: string | URL): Promise<ResponseLike> {
|
||||
const target = url.toString();
|
||||
const mockResponse = mockResponses.get(target);
|
||||
if (mockResponse) {
|
||||
return {
|
||||
ok: mockResponse.status >= 200 && mockResponse.status < 300,
|
||||
status: mockResponse.status,
|
||||
json: async () => mockResponse.body as unknown
|
||||
};
|
||||
}
|
||||
|
||||
const client = target.startsWith('https:') ? https : http;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = client.get(target, response => {
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
response.on('data', (chunk: Buffer | string) => {
|
||||
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
||||
});
|
||||
|
||||
response.on('end', () => {
|
||||
const status = response.statusCode ?? 0;
|
||||
const body = Buffer.concat(chunks).toString();
|
||||
|
||||
resolve({
|
||||
ok: status >= 200 && status < 300,
|
||||
status,
|
||||
json: async () => JSON.parse(body) as unknown
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
request.on('error', error => {
|
||||
reject(new FetchError(error.message, 'system'));
|
||||
});
|
||||
});
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ inputs:
|
||||
required: false
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node24'
|
||||
main: 'lib/index.js'
|
||||
branding:
|
||||
icon: 'package'
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const tseslint = require('@typescript-eslint/eslint-plugin');
|
||||
const jest = require('eslint-plugin-jest');
|
||||
|
||||
const globals = {
|
||||
Atomics: 'readonly',
|
||||
Buffer: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
__dirname: 'readonly',
|
||||
clearTimeout: 'readonly',
|
||||
console: 'readonly',
|
||||
exports: 'writable',
|
||||
module: 'readonly',
|
||||
process: 'readonly',
|
||||
require: 'readonly',
|
||||
setTimeout: 'readonly'
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
ignores: ['lib/**', 'coverage/**', 'node_modules/**']
|
||||
},
|
||||
...tseslint.configs['flat/recommended'],
|
||||
{
|
||||
files: ['src/**/*.ts', '__tests__/**/*.ts'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2019,
|
||||
sourceType: 'module',
|
||||
globals
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['__tests__/**/*.ts'],
|
||||
...jest.configs['flat/recommended'],
|
||||
settings: {
|
||||
jest: {
|
||||
version: 30
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
+16
-2
@@ -4,8 +4,22 @@ module.exports = {
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
moduleNameMapper: {
|
||||
'^@actions/core$': '<rootDir>/__tests__/mocks/actions-core.ts',
|
||||
'^@actions/exec$': '<rootDir>/__tests__/mocks/actions-exec.ts',
|
||||
'^@actions/io$': '<rootDir>/__tests__/mocks/actions-io.ts',
|
||||
'^@actions/tool-cache$': '<rootDir>/__tests__/mocks/actions-tool-cache.ts',
|
||||
'^node-fetch$': '<rootDir>/__tests__/mocks/node-fetch.ts'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
'^.+\\.ts$': [
|
||||
'ts-jest',
|
||||
{
|
||||
tsconfig: {
|
||||
types: ['jest', 'node']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
}
|
||||
|
||||
+41727
-6340
File diff suppressed because one or more lines are too long
Generated
+7591
-13836
File diff suppressed because it is too large
Load Diff
+27
-28
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "actions-hugo",
|
||||
"version": "2.5.0",
|
||||
"version": "3.2.1",
|
||||
"description": "GitHub Actions for Hugo",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">=12.14.1",
|
||||
"npm": ">=6.13.7"
|
||||
"node": ">=24.15.0",
|
||||
"npm": ">=11.12.1"
|
||||
},
|
||||
"scripts": {
|
||||
"all": "npm run format:check && npm run lint && npm test",
|
||||
@@ -14,8 +14,8 @@
|
||||
"test": "jest --coverage --verbose",
|
||||
"build": "ncc build ./src/index.ts -o lib",
|
||||
"tsc": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format:check": "prettier --check **/*.ts",
|
||||
"format": "prettier --write '**/*.ts'",
|
||||
"format:check": "prettier --check '**/*.ts'",
|
||||
"release": "standard-version",
|
||||
"postinstall": "npx husky install"
|
||||
},
|
||||
@@ -25,7 +25,7 @@
|
||||
"eslint"
|
||||
],
|
||||
"README.md": [
|
||||
"npx doctoc@2.0.0 --github"
|
||||
"npx doctoc@2.1.0 --github"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@@ -47,29 +47,28 @@
|
||||
},
|
||||
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.7",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/io": "^1.1.0",
|
||||
"@actions/tool-cache": "^1.6.1",
|
||||
"node-fetch": "^2.6.1"
|
||||
"@actions/core": "3.0.1",
|
||||
"@actions/exec": "3.0.0",
|
||||
"@actions/io": "3.0.2",
|
||||
"@actions/tool-cache": "4.0.0",
|
||||
"node-fetch": "3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/node": "~12",
|
||||
"@types/node-fetch": "^2.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
||||
"@typescript-eslint/parser": "^4.16.1",
|
||||
"@vercel/ncc": "^0.27.0",
|
||||
"eslint": "^7.21.0",
|
||||
"eslint-plugin-jest": "^24.1.5",
|
||||
"husky": "^5.1.3",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"lint-staged": "^10.5.4",
|
||||
"nock": "^13.0.10",
|
||||
"prettier": "2.2.1",
|
||||
"standard-version": "^9.1.1",
|
||||
"ts-jest": "^26.5.3",
|
||||
"typescript": "^4.2.3"
|
||||
"@types/jest": "30.0.0",
|
||||
"@types/node": "25.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "8.59.2",
|
||||
"@typescript-eslint/parser": "8.59.2",
|
||||
"@vercel/ncc": "0.38.4",
|
||||
"eslint": "10.3.0",
|
||||
"eslint-plugin-jest": "29.15.2",
|
||||
"husky": "9.1.7",
|
||||
"jest": "30.4.2",
|
||||
"jest-circus": "30.4.2",
|
||||
"lint-staged": "17.0.4",
|
||||
"nock": "14.0.15",
|
||||
"prettier": "3.8.3",
|
||||
"standard-version": "9.5.0",
|
||||
"ts-jest": "29.4.9",
|
||||
"typescript": "6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,12 +1,12 @@
|
||||
export enum Tool {
|
||||
Name = 'Hugo',
|
||||
Org = 'gohugoio',
|
||||
Repo = 'hugo',
|
||||
CmdName = 'hugo',
|
||||
CmdOptVersion = 'version',
|
||||
TestVersionLatest = '0.83.1',
|
||||
TestVersionSpec = '0.82.1'
|
||||
}
|
||||
export const Tool = {
|
||||
Name: 'Hugo',
|
||||
Org: 'gohugoio',
|
||||
Repo: 'hugo',
|
||||
CmdName: 'hugo',
|
||||
CmdOptVersion: 'version',
|
||||
TestVersionLatest: '0.83.1',
|
||||
TestVersionSpec: '0.82.1'
|
||||
} as const;
|
||||
|
||||
export enum Action {
|
||||
WorkDirName = 'actions_hugo',
|
||||
|
||||
+14
-4
@@ -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 (conventions.arch.darwinUniversal && (os === 'darwin' || os === 'macOS')) {
|
||||
return 'universal';
|
||||
}
|
||||
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
return '64bit';
|
||||
return conventions.arch.standardizedNaming ? 'amd64' : '64bit';
|
||||
case 'arm':
|
||||
return 'ARM';
|
||||
if (conventions.arch.droppedWindowsArmSupport && (os === 'Windows' || os === 'windows')) {
|
||||
throw new Error(`${arch} is not supported`);
|
||||
}
|
||||
|
||||
return conventions.arch.standardizedNaming ? 'arm' : 'ARM';
|
||||
case 'arm64':
|
||||
return 'ARM64';
|
||||
return conventions.arch.standardizedNaming ? 'arm64' : 'ARM64';
|
||||
default:
|
||||
throw new Error(`${arch} is not supported`);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
export interface conventions {
|
||||
arch: {
|
||||
darwinUniversal: boolean;
|
||||
droppedWindowsArmSupport: boolean;
|
||||
standardizedNaming: boolean;
|
||||
};
|
||||
os: {
|
||||
renamedMacOS: boolean;
|
||||
downcasedAll: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export 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,
|
||||
droppedWindowsArmSupport: newerThan102,
|
||||
standardizedNaming: newerThan103
|
||||
},
|
||||
os: {
|
||||
renamedMacOS: newerThan103,
|
||||
downcasedAll: newerThan103
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,14 @@
|
||||
import fetch from 'node-fetch';
|
||||
import fetch, {FetchError} from 'node-fetch';
|
||||
|
||||
interface BrewFormulaResponse {
|
||||
versions: {
|
||||
stable: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface GitHubReleaseResponse {
|
||||
tag_name: string;
|
||||
}
|
||||
|
||||
export function getURL(org: string, repo: string, api: string): string {
|
||||
let url = '';
|
||||
@@ -15,12 +25,16 @@ export function getURL(org: string, repo: string, api: string): string {
|
||||
export async function getLatestVersion(org: string, repo: string, api: string): Promise<string> {
|
||||
const url = getURL(org, repo, api);
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new FetchError(`request to ${url} failed with status ${response.status}`, 'system');
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
let latestVersion = '';
|
||||
if (api === 'brew') {
|
||||
latestVersion = json.versions.stable;
|
||||
latestVersion = (json as BrewFormulaResponse).versions.stable;
|
||||
} else if (api === 'github') {
|
||||
latestVersion = json.tag_name;
|
||||
latestVersion = (json as GitHubReleaseResponse).tag_name;
|
||||
}
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,11 +1,13 @@
|
||||
export default function getOS(platform: string): string {
|
||||
import {conventions} from './get-conventions';
|
||||
|
||||
export default function getOS(platform: string, conventions: conventions): string {
|
||||
switch (platform) {
|
||||
case 'linux':
|
||||
return 'Linux';
|
||||
return conventions.os.downcasedAll ? 'linux' : 'Linux';
|
||||
case 'darwin':
|
||||
return 'macOS';
|
||||
return conventions.os.renamedMacOS ? 'darwin' : 'macOS';
|
||||
case 'win32':
|
||||
return 'Windows';
|
||||
return conventions.os.downcasedAll ? 'windows' : 'Windows';
|
||||
default:
|
||||
throw new Error(`${platform} is not supported`);
|
||||
}
|
||||
|
||||
+74
-9
@@ -3,7 +3,9 @@ export default function getURL(
|
||||
arch: string,
|
||||
extended: string,
|
||||
version: string
|
||||
): string {
|
||||
): string[] {
|
||||
const downloadVersion = getDownloadVersion(version);
|
||||
|
||||
const extendedStr = (extended: string): string => {
|
||||
if (extended === 'true') {
|
||||
return 'extended_';
|
||||
@@ -14,17 +16,80 @@ export default function getURL(
|
||||
}
|
||||
};
|
||||
|
||||
const ext = (os: string): string => {
|
||||
if (os === 'Windows') {
|
||||
return 'zip';
|
||||
} else {
|
||||
return 'tar.gz';
|
||||
const lowerArch = (arch: string): string => {
|
||||
switch (arch) {
|
||||
case '64bit':
|
||||
return 'amd64';
|
||||
case 'ARM':
|
||||
return 'arm';
|
||||
case 'ARM64':
|
||||
return 'arm64';
|
||||
default:
|
||||
return arch.toLowerCase();
|
||||
}
|
||||
};
|
||||
|
||||
const hugoName = `hugo_${extendedStr(extended)}${version}_${os}-${arch}`;
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
||||
const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
||||
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${downloadVersion}/${assetName}`;
|
||||
});
|
||||
};
|
||||
|
||||
return url;
|
||||
if (os === 'macOS') {
|
||||
return assetURLs(
|
||||
assetBases.flatMap(assetBase => [
|
||||
`${assetBase}macOS-${arch}.tar.gz`,
|
||||
`${assetBase}macOS-${arch}.zip`,
|
||||
`${assetBase}macOS-all.tar.gz`,
|
||||
`${assetBase}darwin-universal.tar.gz`,
|
||||
`${assetBase}darwin-universal.pkg`
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
if (os === 'darwin') {
|
||||
return assetURLs(
|
||||
assetBases.flatMap(assetBase => [
|
||||
`${assetBase}darwin-${arch}.tar.gz`,
|
||||
`${assetBase}darwin-${arch}.pkg`
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
if (os === 'Windows' || os === 'windows') {
|
||||
const assetPatterns =
|
||||
os === 'windows'
|
||||
? [`windows-${lowerArch(arch)}.zip`, `Windows-${arch}.zip`]
|
||||
: [`Windows-${arch}.zip`, `windows-${lowerArch(arch)}.zip`];
|
||||
|
||||
return assetURLs(
|
||||
assetBases.flatMap(assetBase => assetPatterns.map(asset => `${assetBase}${asset}`))
|
||||
);
|
||||
}
|
||||
|
||||
if (os === 'Linux' || os === 'linux') {
|
||||
const assetPatterns =
|
||||
os === 'linux'
|
||||
? [`linux-${lowerArch(arch)}.tar.gz`, `Linux-${arch}.tar.gz`, `Linux_${arch}.tar.gz`]
|
||||
: [`Linux-${arch}.tar.gz`, `Linux_${arch}.tar.gz`, `linux-${lowerArch(arch)}.tar.gz`];
|
||||
|
||||
return assetURLs(
|
||||
assetBases.flatMap(assetBase => assetPatterns.map(asset => `${assetBase}${asset}`))
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ import * as main from './main';
|
||||
try {
|
||||
await main.run();
|
||||
} catch (e) {
|
||||
core.setFailed(`Action failed with error ${e.message}`);
|
||||
const message = e instanceof Error ? e.message : String(e);
|
||||
core.setFailed(`Action failed with error ${message}`);
|
||||
}
|
||||
})();
|
||||
|
||||
+81
-15
@@ -1,12 +1,19 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as io from '@actions/io';
|
||||
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';
|
||||
|
||||
export interface DownloadedAsset {
|
||||
path: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export function getHomeDir(): string {
|
||||
let homedir = '';
|
||||
|
||||
@@ -43,31 +50,90 @@ export async function createBinDir(workDir: string): Promise<string> {
|
||||
return binDir;
|
||||
}
|
||||
|
||||
export function isRetryableDownloadError(error: unknown): boolean {
|
||||
const message = error instanceof Error ? error.message : `${error}`;
|
||||
return (
|
||||
message.includes('Unexpected HTTP response: 404') ||
|
||||
message.includes('Code(404)') ||
|
||||
(message.includes('404') && message.includes('Not Found'))
|
||||
);
|
||||
}
|
||||
|
||||
export function isWindowsAsset(assetURL: string): boolean {
|
||||
return /(?:Windows[-_]|windows[-_])/.test(assetURL);
|
||||
}
|
||||
|
||||
export async function downloadHugoAsset(toolURLs: string[]): Promise<DownloadedAsset> {
|
||||
for (const toolURL of toolURLs) {
|
||||
core.debug(`toolURL: ${toolURL}`);
|
||||
|
||||
try {
|
||||
return {
|
||||
path: await tc.downloadTool(toolURL),
|
||||
url: toolURL
|
||||
};
|
||||
} catch (error) {
|
||||
if (!isRetryableDownloadError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
core.debug(`Hugo asset not found at ${toolURL}`);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Unable to find a compatible Hugo release asset for this runner. Tried:\n${toolURLs.join('\n')}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function extractHugoAsset(
|
||||
assetPath: string,
|
||||
assetURL: string,
|
||||
tempDir: string,
|
||||
binDir: string
|
||||
): Promise<void> {
|
||||
let toolBin = '';
|
||||
|
||||
if (assetURL.endsWith('.zip')) {
|
||||
const toolExtractedFolder: string = await tc.extractZip(assetPath, tempDir);
|
||||
const toolCmd = isWindowsAsset(assetURL) ? `${Tool.CmdName}.exe` : Tool.CmdName;
|
||||
toolBin = path.join(toolExtractedFolder, toolCmd);
|
||||
} else if (assetURL.endsWith('.pkg')) {
|
||||
const pkgExtractedFolder = path.join(tempDir, 'pkg');
|
||||
await exec.exec('pkgutil', ['--expand-full', assetPath, pkgExtractedFolder]);
|
||||
toolBin = path.join(pkgExtractedFolder, 'Payload', Tool.CmdName);
|
||||
} else {
|
||||
const toolExtractedFolder: string = await tc.extractTar(assetPath, tempDir);
|
||||
toolBin = path.join(toolExtractedFolder, Tool.CmdName);
|
||||
}
|
||||
|
||||
await io.mv(toolBin, binDir);
|
||||
}
|
||||
|
||||
export async function installer(version: string): Promise<void> {
|
||||
const extended: string = core.getInput('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}`);
|
||||
|
||||
const archName: string = getArch(process.arch);
|
||||
const archName: string = getArch(process.arch, osName, conventions);
|
||||
core.debug(`Processor Architecture: ${archName}`);
|
||||
|
||||
const toolURL: string = getURL(osName, archName, extended, version);
|
||||
core.debug(`toolURL: ${toolURL}`);
|
||||
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);
|
||||
const tempDir = await createTempDir(workDir);
|
||||
|
||||
const toolAssets: string = await tc.downloadTool(toolURL);
|
||||
let toolBin = '';
|
||||
if (process.platform === 'win32') {
|
||||
const toolExtractedFolder: string = await tc.extractZip(toolAssets, tempDir);
|
||||
toolBin = `${toolExtractedFolder}/${Tool.CmdName}.exe`;
|
||||
} else {
|
||||
const toolExtractedFolder: string = await tc.extractTar(toolAssets, tempDir);
|
||||
toolBin = `${toolExtractedFolder}/${Tool.CmdName}`;
|
||||
}
|
||||
await io.mv(toolBin, binDir);
|
||||
const toolAsset: DownloadedAsset = await downloadHugoAsset(toolURLs);
|
||||
await extractHugoAsset(toolAsset.path, toolAsset.url, tempDir, binDir);
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2019"],
|
||||
"module": "commonjs",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"target": "ES2019",
|
||||
"sourceMap": true,
|
||||
"outDir": "./lib",
|
||||
@@ -12,5 +13,5 @@
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
"exclude": ["node_modules", "__tests__"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user