Commit Graph

18 Commits

Author SHA1 Message Date
Shohei Ueda b1937e141c fix: Hugo package naming fix (#688)
## Summary

Rebases the Hugo package naming fix from #609 on top of the current
`main` branch, including the installer flow added in #687.

- Derive Hugo release asset OS and architecture naming conventions from
the requested Hugo version.
- Apply those conventions when selecting OS and architecture segments,
including the 0.102.x macOS universal boundary, 0.103+ downcased OS
names, Windows zip assets, and Linux ARM assets.
- Add table-driven tests for pre-0.102, 0.102.x, and 0.103+ naming
behavior, plus URL coverage for the corrected release asset names.

## Changes

- Add `getConventions` to centralize version-based release asset naming
decisions.
- Update `getOS` and `getArch` to use convention flags for macOS,
lower-case OS names, standardized architecture names, and the Windows
ARM support boundary.
- Update `getURL` to generate candidate URLs for downcased Windows and
Linux assets, and for darwin universal archives.
- Wire convention detection into `installer` before generating candidate
Hugo release asset URLs.
- Expand unit coverage for OS, architecture, convention, and URL
behavior.

## Checklist

- [x] I have read the latest README and followed the instructions.
- [x] I have added or updated tests for behavior changes.
- [x] README.md and action.yml updates are not needed because inputs and
action metadata are unchanged.
- [x] I have run the relevant verification commands.

## References

- Rebased follow-up for
https://github.com/peaceiris/actions-hugo/pull/609
- References https://github.com/peaceiris/actions-hugo/issues/605 and
https://github.com/peaceiris/actions-hugo/issues/608
- Based on `main` after
https://github.com/peaceiris/actions-hugo/pull/687

## Verification

- [x] `RUNNER_TEMP=/private/tmp npm run all`
- [ ] `npm run build` was not run because this branch does not update
bundled output and current `main` removed `lib/index.js`.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Version-aware conventions control OS and architecture naming,
including macOS universal asset support and expanded darwin/macOS
patterns.

* **Refactor**
* Conventions centralized and applied across installer and URL
generation; OS/arch inputs accept varied casing and naming variants.

* **Tests**
* Expanded, data-driven parameterized tests for conventions, OS/arch
mappings, URL variants, and error cases.
* Replaced network stubs with deterministic fetch-mock helpers for test
isolation.

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/peaceiris/actions-hugo/pull/688)
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Michael T Lombardi <michael.t.lombardi@gmail.com>
Co-authored-by: codefactor-io <support@codefactor.io>
Co-authored-by: Codex <noreply@openai.com>
2026-05-11 00:23:26 +09:00
Shohei Ueda 189731ef00 build: update npm dependencies (#689)
## Summary

Update all direct npm dependencies and devDependencies to the current
npm latest versions and pin them exactly instead of using caret or tilde
ranges.

## Changes

- Pin all direct runtime and development package versions in
`package.json` and refresh `package-lock.json`.
- Migrate ESLint from `.eslintrc.json` to flat config for ESLint 10.
- Update Jest and TypeScript configuration and test mocks to support the
latest ESM-only packages.
- Add response status handling and typed JSON access for the latest
`node-fetch` types.

## Checklist

- [x] I have read the latest README and followed the instructions.
- [x] I have added or updated tests for behavior changes.
- [x] I have updated README.md and action.yml when inputs or runtime
behavior changed.
- [x] I have run the relevant verification commands.

## Verification

- [x] `npm --userconfig=/private/tmp/empty-npmrc outdated --json
--include=dev` returned `{}`
- [x] `npm run all`
- [x] `npm run build`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added comprehensive test mocks for Actions APIs and fetch, improved
integration tests, and updated assertions for more precise error
validation.
  * Configured Jest to map external modules to local test mocks.

* **Chores**
* Migrated ESLint to the flat config format and replaced prior ESLint
config.
* Updated project dependencies and modernized TypeScript compiler
settings.

* **Refactor**
* Adjusted exported tool constants and made error handling more explicit
in version-fetching logic.

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/peaceiris/actions-hugo/pull/689)
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Codex <noreply@openai.com>
2026-05-10 23:30:59 +09:00
Shohei Ueda 187a5efe81 feat: support renamed Hugo release assets (#687)
## Summary
- Support multiple Hugo release asset names for Linux, macOS, and
Windows so renamed upstream assets no longer fail with a plain 404.
- Preserve compatibility with legacy Hugo assets that used filename
forms such as `hugo_v0.20.3_*`, macOS `.zip` archives, and
`Linux_ARM`-style names.
- Add retry handling for missing candidate assets and macOS `.pkg`
extraction via `pkgutil --expand-full`, with focused URL and installer
tests plus the rebuilt `lib/index.js` bundle.

## References
- Fixes https://github.com/peaceiris/actions-hugo/issues/652
- `hugo-version: latest` still resolves through Homebrew; this change
does not fall back to an older Hugo version when the resolved release
has no compatible asset.
- Review note: `lib/index.js` is generated by `npm run build` and
contains bundled dependency code.

## Test plan
- [x] `RUNNER_TEMP=/tmp npm run all`
- [x] `npm run build`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Broadened test coverage for asset URL generation, download retry
behavior, and extraction across OSes and architectures.

* **Bug Fixes**
* More resilient installer with multiple candidate download URLs and
retry handling for transient failures.
* Improved extraction logic to correctly handle platform- and
format-specific archives.

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/peaceiris/actions-hugo/pull/687)
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Codex <noreply@openai.com>
2026-05-10 22:40:55 +09:00
Shohei Ueda 64e0f66acb ci: harden workflows and update Node.js (#686) 2026-05-10 18:21:41 +09:00
Steve Teuber 6d30a88741 feat: Add support for different processor architectures (#518)
ARM, ARM64
2021-05-27 13:03:38 +09:00
Shohei Ueda 8bff475612 chore: change printWidth from 80 to 100 (#365) 2020-06-22 05:40:06 +09:00
yutopp 54af4c1320 fix: Wrap an entrypoint by async to handle exceptions correctly (#363)
* fix: add return type

Co-authored-by: Shohei Ueda <30958501+peaceiris@users.noreply.github.com>
2020-06-21 13:16:10 +09:00
Shohei Ueda 94853340b9 fix: action failure status (#151)
Close #149

* chore: fix path to .gitconfig
2020-01-25 12:42:32 +09:00
Shohei Ueda b55f1c81fb test: Add fail to fetch latest due to 404 (#137) 2020-01-21 01:35:00 +09:00
Shohei Ueda 283bc47636 refactor: main and installer (#133)
* refactor: installer
* test: Fix workDir cleanup
2020-01-18 12:07:13 +09:00
Shohei Ueda 442aa4dbd4 test: Add unit testing (get-latest-version) (#132) 2020-01-18 11:11:17 +09:00
Shohei Ueda 386980e22b test: Add integration testing (#131)
* docs: Update description
* deps: Add nock
* chore: Add resolveJsonModule
* test: Add integration testing
* chore: Add @typescript-eslint/eslint-plugin
* refactor: Fix lint errors
* chore: Add eslint-plugin-jest
* refactor: Fix lint errors
* test: Add remove working files
* ci: Comment out cache steps
2020-01-18 10:29:06 +09:00
Shohei Ueda 4642226db0 refactor: Use node-fetch instead of xmlhttprequest (#130)
* deps: Add node-fetch, remove xmlhttprequest
* refactor: Use node-fetch instead of xmlhttprequest
2020-01-18 04:36:10 +09:00
Shohei Ueda 739a95f1e7 gha: Enhance workflows (#102)
* gha: Add Pull Request to stale target
* gha: Add ncc check step (Close #98 )
* src: Rename showVersion()
* test: Add not to be cases
* Remove old comment
* gha: Add update major tag workflow (Close #97 )
2019-12-08 15:45:59 +09:00
Shohei Ueda ef869fb22f Path join (#92) 2019-11-22 11:14:44 +09:00
Shohei Ueda d7d48e3009 Refactor: enhance Hugo version dumping (#39) 2019-09-22 10:24:28 +09:00
Shohei Ueda e194c83989 Refactor: remove Golang and Git dumping (#37)
* ci: setup lint-staged
* refactor: remove golang and git dumping
2019-09-22 08:13:23 +09:00
Shohei Ueda dc8541739a Feat: Support macOS and Windows, migrate JavaScript to TypeScript (#32)
- Support macOS and Windows (Close #24 )
- Refactoring
  - Error handling
  - TypeScript
- Prettier (Close #29 )
- GHA: Add upload-artifact step for test coverage
- deps: Install husky
2019-09-21 10:41:21 +09:00