-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Cache NodeJS PNPM | ||
author: 'MiLaboratories' | ||
description: | | ||
Cache NodeJS modules when using pnpm. | ||
inputs: | ||
cache-version: | ||
description: | | ||
Simple hack, that allows to 'reset' cache for particular job. | ||
Just change the value of this parameter and the next run will | ||
not find build cache and will have to start from scratch. | ||
required: false | ||
default: 'v1' | ||
|
||
hashfiles-search-path: | ||
description: | | ||
Hashfiles search path for pnpm-lock.yaml | ||
required: false | ||
default: '**/pnpm-lock.yaml' | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Get pnpm store path | ||
id: pnpm-store-path | ||
uses: milaboratory/github-ci/actions/shell@v4 | ||
with: | ||
run: | | ||
STORE_PATH=$(pnpm store path) | ||
echo "${STORE_PATH}" | ||
- name: Cache Node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.pnpm-store-path.outputs.stdout }} | ||
key: ${{ runner.OS }}-pnpm-cache-${{ inputs.cache-version }}-genericnodejs-${{ hashFiles(inputs.hashfiles-search-path) }} | ||
restore-keys: | | ||
${{ runner.OS }}-pnpm-cache-${{ inputs.cache-version }}-genericnodejs- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Prepare environment for NodeJS PNPM | ||
author: 'MiLaboratories' | ||
description: | | ||
Prepare environment: install specific version of Node, restore cache for modules. | ||
inputs: | ||
node-version: | ||
description: | | ||
Node version to use. | ||
Examples: '16.x', '14.x' | ||
required: true | ||
|
||
cache-version: | ||
description: | | ||
Simple hack, that allows to 'reset' cache for particular job. | ||
Just change the value of this parameter and the next run will | ||
not find build cache and will have to start from scratch. | ||
required: false | ||
default: 'v1' | ||
|
||
pnpm-version: | ||
description: | | ||
Version of pnpm to install | ||
required: false | ||
default: 'latest' | ||
|
||
hashfiles-search-path: | ||
description: | | ||
Hashfiles search path for pnpm-lock.yaml | ||
required: false | ||
default: '**/pnpm-lock.yaml' | ||
|
||
registry-url: | ||
description: | | ||
The npm registry url to set up for auth | ||
and publication of the node js package. | ||
required: false | ||
default: 'https://npm.pkg.github.com' | ||
|
||
scope: | ||
description: | | ||
Scope for authenticating against npm registries. | ||
required: false | ||
default: ${{ format('{0}{1}', '@', github.repository_owner) }} | ||
|
||
always-auth: | ||
description: | | ||
Set always-auth in npmrc. | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Install NodeJS - ${{ inputs.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
registry-url: ${{ inputs.registry-url }} | ||
scope: ${{ inputs.scope }} | ||
always-auth: ${{ inputs.always-auth }} | ||
|
||
- name: Install pnpm - ${{ inputs.pnpm-version }} | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: ${{ inputs.pnpm-version }} | ||
|
||
- name: Set up cache for a NodeJS PNPM application | ||
uses: milaboratory/github-ci/actions/node/cache-pnpm@v4 | ||
with: | ||
hashfiles-search-path: ${{ inputs.hashfiles-search-path }} | ||
cache-version: ${{ inputs.cache-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters