4
4
name : Node.js Package
5
5
6
6
on :
7
- pull_request :
8
- push :
9
- branches :
10
- - main
11
- - master
7
+ workflow_call :
12
8
13
9
jobs :
14
- test :
10
+ publish-npm :
15
11
runs-on : ubuntu-latest
16
12
steps :
17
- # Clone ether/etherpad-lite to ../etherpad-lite so that ep_etherpad-lite
18
- # can be "installed" in this plugin's node_modules. The checkout v2 action
19
- # doesn't support cloning outside of $GITHUB_WORKSPACE (see
20
- # https://github.com/actions/checkout/issues/197), so the repo is first
21
- # cloned to etherpad-lite then moved to ../etherpad-lite. To avoid
22
- # conflicts with this plugin's clone, etherpad-lite must be cloned and
23
- # moved out before this plugin's repo is cloned to $GITHUB_WORKSPACE.
24
- -
13
+ - uses : actions/setup-node@v4
14
+ with :
15
+ node-version : 20
16
+ registry-url : https://registry.npmjs.org/
17
+ - name : Check out Etherpad core
25
18
uses : actions/checkout@v3
26
19
with :
27
20
repository : ether/etherpad-lite
28
- path : etherpad-lite
29
- -
30
- run : mv etherpad-lite ..
31
- # etherpad-lite has been moved outside of $GITHUB_WORKSPACE, so it is now
32
- # safe to clone this plugin's repo to $GITHUB_WORKSPACE.
33
- -
34
- uses : actions/checkout@v3
35
- # This is necessary for actions/setup-node because '..' can't be used in
36
- # cache-dependency-path.
37
- -
38
- name : Create ep_etherpad-lite symlink
21
+ - uses : pnpm/action-setup@v3
22
+ name : Install pnpm
23
+ with :
24
+ version : 8
25
+ run_install : false
26
+ - name : Get pnpm store directory
27
+ shell : bash
39
28
run : |
40
- mkdir -p node_modules
41
- ln -s ../../etherpad-lite/src node_modules/ep_etherpad-lite
42
- -
43
- uses : actions/setup-node@v3
29
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30
+ - uses : actions/cache@v4
31
+ name : Setup pnpm cache
44
32
with :
45
- node-version : 12
46
- cache : ' npm'
47
- cache-dependency-path : |
48
- node_modules/ep_etherpad-lite/package-lock.json
49
- node_modules/ep_etherpad-lite/bin/doc/package-lock.json
50
- package-lock.json
51
- # All of ep_etherpad-lite's devDependencies are installed because the
52
- # plugin might do `require('ep_etherpad-lite/node_modules/${devDep}')`.
53
- # Eventually it would be nice to create an ESLint plugin that prohibits
54
- # Etherpad plugins from piggybacking off of ep_etherpad-lite's
55
- # devDependencies. If we had that, we could change this line to only
56
- # install production dependencies.
57
- -
58
- run : cd ../etherpad-lite/src && npm ci
59
- -
60
- run : npm ci
61
- # This runs some sanity checks and creates a symlink at
62
- # node_modules/ep_etherpad-lite that points to ../../etherpad-lite/src.
63
- # This step must be done after `npm ci` installs the plugin's dependencies
64
- # because npm "helpfully" cleans up such symlinks. :( Installing
65
- # ep_etherpad-lite in the plugin's node_modules prevents lint errors and
66
- # unit test failures if the plugin does `require('ep_etherpad-lite/foo')`.
67
- -
68
- run : npm install --no-save ep_etherpad-lite@file:../etherpad-lite/src
69
- -
70
- run : npm test
71
- -
72
- run : npm run lint
73
-
74
- publish-npm :
75
- if : github.event_name == 'push'
76
- needs : test
77
- runs-on : ubuntu-latest
78
- steps :
33
+ path : ${{ env.STORE_PATH }}
34
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
35
+ restore-keys : |
36
+ ${{ runner.os }}-pnpm-store-
79
37
-
80
38
uses : actions/checkout@v3
81
39
with :
82
40
fetch-depth : 0
83
- -
84
- uses : actions/setup-node@v3
85
- with :
86
- node-version : 12
87
- registry-url : https://registry.npmjs.org/
88
- cache : ' npm'
89
41
-
90
42
name : Bump version (patch)
91
43
run : |
@@ -94,13 +46,13 @@ jobs:
94
46
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
95
47
git config user.name 'github-actions[bot]'
96
48
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
97
- npm ci
98
- npm version patch
49
+ pnpm i
50
+ pnpm version patch
99
51
git push --follow-tags
100
52
# This is required if the package has a prepare script that uses something
101
53
# in dependencies or devDependencies.
102
54
-
103
- run : npm ci
55
+ run : pnpm i
104
56
# `npm publish` must come after `git push` otherwise there is a race
105
57
# condition: If two PRs are merged back-to-back then master/main will be
106
58
# updated with the commits from the second PR before the first PR's
@@ -112,11 +64,11 @@ jobs:
112
64
# back-to-back merges will cause the first merge's workflow to fail but
113
65
# the second's will succeed.
114
66
-
115
- run : npm publish
116
- env :
117
- NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
118
- -
119
- name : Add package to etherpad organization
120
- run : npm access grant read-write etherpad:developers
67
+ run : pnpm publish
121
68
env :
122
69
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
70
+ # -
71
+ # name: Add package to etherpad organization
72
+ # run: pnpm access grant read-write etherpad:developers
73
+ # env:
74
+ # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
0 commit comments