Skip to content

Commit

Permalink
Merge to v4 2024 08 14 (#60)
Browse files Browse the repository at this point in the history
merge v4-beta to v4
  • Loading branch information
mike-ainsel authored Aug 14, 2024
1 parent cc79e67 commit e37aa78
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 6 deletions.
41 changes: 41 additions & 0 deletions actions/node/cache-pnpm/action.yaml
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-
12 changes: 9 additions & 3 deletions actions/node/cache/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cache NodeJs/Electron
name: Cache NodeJS/Electron
author: 'MiLaboratories'
description: |
Cache Electon or NodeJS modules and (optionally) local node_modules
Expand Down Expand Up @@ -43,6 +43,7 @@ runs:
path: |
~/.cache/electron/
~/Library/Caches/electron/
~/AppData/Local/electron/Cache/
key: ${{ runner.OS }}-cache-${{ inputs.cache-version }}-electron-${{ hashFiles(inputs.hashfiles-search-path) }}
restore-keys: |
${{ runner.OS }}-cache-${{ inputs.cache-version }}-electron-
Expand All @@ -56,11 +57,16 @@ runs:
restore-keys: |
${{ runner.OS }}-cache-${{ inputs.cache-version }}-node_modules-
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache Node modules
uses: actions/cache@v4
if: inputs.is-electron-application == 'false'
with:
path: ~/.npm
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.OS }}-cache-${{ inputs.cache-version }}-genericnodejs-${{ hashFiles(inputs.hashfiles-search-path) }}
restore-keys: |
${{ runner.OS }}-cache-${{ inputs.cache-version }}-genericnodejs-
${{ runner.OS }}-cache-${{ inputs.cache-version }}-genericnodejs-
75 changes: 75 additions & 0 deletions actions/node/prepare-pnpm/action.yaml
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 }}
4 changes: 2 additions & 2 deletions actions/node/prepare/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ runs:
using: "composite"

steps:
- name: Install NodeJS ${{ inputs.node-version }}
- 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: Setup cache for a NodeJS/Electron application
- name: Set up cache for a NodeJS/Electron application
uses: milaboratory/github-ci/actions/node/cache@v4
with:
is-electron-application: ${{ inputs.is-electron-application }}
Expand Down
2 changes: 1 addition & 1 deletion blocks/notify/test-regression/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ runs:
else
echo "${CURRENT_VERSION}"
fi
- id: json
uses: milaboratory/github-ci/actions/shell@v4
env:
Expand Down

0 comments on commit e37aa78

Please sign in to comment.