File tree 2 files changed +32
-10
lines changed
2 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -55,23 +55,16 @@ jobs:
55
55
needs : [checks, security]
56
56
steps :
57
57
- uses : actions/checkout@v3
58
- # Setup .npmrc file to publish to npm
59
58
- uses : actions/setup-node@v3
60
59
with :
61
60
node-version : ' 10'
61
+ # Setup .npmrc file to publish to npm
62
62
registry-url : ' https://registry.npmjs.org'
63
63
- uses : actions/cache@v3
64
64
with :
65
- # This is cache where npm installs from before going out to the network
66
- path : ~/.npm
65
+ path : ~/.npm # this is cache where npm installs from before going out to the network
67
66
key : ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
68
67
- run : npm install --prefer-offline
69
- - if : ${{ !contains(github.ref_name, '-test.') }}
70
- run : npm publish --tag latest-v3.x
71
- env :
72
- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
73
- # If "test" prerelease is present, pretend to publish package.
74
- - if : ${{ contains(github.ref_name, '-test.') }}
75
- run : npm publish --tag latest-v3.x --dry-run
68
+ - run : ./release
76
69
env :
77
70
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -xv
2
+
3
+ # Removes "v" prefix
4
+ version=${GITHUB_REF_NAME: 1}
5
+
6
+ # Major of the version being handled by the current workflow
7
+ workflow_major=$( echo $version | cut -d. -f1)
8
+
9
+ workflow_track=" latest-v${workflow_major} .x"
10
+
11
+ # Major of the version published under the current "latest" npm tag
12
+ latest_major=$( npm view cross-fetch@latest version | cut -d. -f1)
13
+
14
+
15
+ # If it's test prerelease, we just want to test the release workflow (dry run it!)
16
+ if [[ " $version " == * " -test." * ]]; then
17
+ npm publish --tag $workflow_track --dry-run && \
18
+ exit 0
19
+ fi
20
+
21
+ npm publish --tag $workflow_track
22
+
23
+ if [[ " $workflow_major " == " $latest_major " ]]; then
24
+ npm dist-tag add cross-fetch@$version latest
25
+ fi
26
+
27
+ if [[ " $workflow_major " == " $(( $latest_major + 1 )) " ]]; then
28
+ npm dist-tag add cross-fetch@$version next
29
+ fi
You can’t perform that action at this time.
0 commit comments