Skip to content

Commit

Permalink
new: Allow moon to be manually installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 3, 2024
1 parent b6e638b commit b544ee3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.3.1

- moon can be forced installed by setting `moon-version`, instead of relying on file detection.

# 0.3.0

- Now includes the moon and proto versions in the cache key.
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A GitHub action that sets up an environment for proto and moon.

- Installs `proto` globally so that installed tools can also be executed globally.
- Conditionally installs `moon` globally if the repository is using moon (attempts to detect a
`.moon` directory).
`.moon` directory), or `moon-version` is set.
- Caches the toolchain (`~/.proto`) so subsequent runs are faster.
- Hashes `.prototools` and `.moon/toolchain.yml` files to generate a unique cache key.
- Cleans the toolchain before caching to remove unused or stale tools.
Expand Down Expand Up @@ -33,8 +33,7 @@ jobs:
- `cache` - Toggle caching of the toolchain directory. Defaults to `true`.
- `cache-base` - Base branch/ref to save a warmup cache on. Other branches/refs will restore from
this base.
- `moon-version` - Version of moon to explicitly install (if repository is using moon). Defaults to
"latest".
- `proto-version` - Version of proto to explicitly install. Defaults to "latest".
- `moon-version` - Version of moon to explicitly install.
- `proto-version` - Version of proto to explicitly install.
- `workspace-root` - Relative path to moon's workspace root if initialized in a sub-directory.
Defaults to "".
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ inputs:
description:
'Base branch/ref to save a warmup cache on. Other branches/refs will restore from this base.'
moon-version:
default: 'latest'
description: 'Version of moon to install (if repository is using moon).'
default: ''
description: 'Version of moon to install.'
required: false
proto-version:
default: 'latest'
default: ''
description: 'Version of proto to install.'
required: false
workspace-root:
Expand Down
5 changes: 4 additions & 1 deletion helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export function isCacheEnabled() {
}

export function isUsingMoon() {
return fs.existsSync(path.join(getWorkingDir(), core.getInput('workspace-root'), '.moon'));
return (
!!core.getInput('moon-version') ||
fs.existsSync(path.join(getWorkingDir(), core.getInput('workspace-root'), '.moon'))
);
}

export function extractMajorMinor(version: string) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/setup-toolchain",
"version": "0.3.0",
"version": "0.3.1",
"description": "A GitHub action to setup and cache the proto and moon toolchains.",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit b544ee3

Please sign in to comment.