Skip to content

Commit 22f943e

Browse files
committed
Update npm.yml to replace deprecated actions and improve cache keys.
1 parent 01d4f05 commit 22f943e

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/npm.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
## name of our action
21
name: "NPM Publish"
32

4-
# the event that will trigger the action
53
on:
64
push:
75
branches: [main]
86

9-
# what the action will do
107
jobs:
118
release:
12-
# the operating system it will run on
139
runs-on: ubuntu-latest
14-
# this check needs to be in place to prevent a publish loop with auto and github actions
1510
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
16-
# the list of steps that the action will go through
1711
steps:
18-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
1916
- name: Prepare repository
20-
run: git fetch --unshallow --tags
17+
run: git fetch --unshallow --tags || true
18+
2119
- name: Use Node.js 18.x
22-
uses: actions/setup-node@v1
20+
uses: actions/setup-node@v4
2321
with:
2422
node-version: 18.x
23+
cache: 'yarn'
24+
2525
- name: Cache node modules
26-
uses: actions/cache@v1
26+
uses: actions/cache@v4
2727
with:
28-
path: node_modules
29-
key: yarn-deps-${{ hashFiles('yarn.lock') }}
28+
path: |
29+
node_modules
30+
~/.cache/yarn
31+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3032
restore-keys: |
31-
yarn-deps-${{ hashFiles('yarn.lock') }}
33+
${{ runner.os }}-yarn-
3234
3335
- name: Create Release
3436
env:

0 commit comments

Comments
 (0)