File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 4545
4646 - name : Run tests
4747 run : npm test
48+
49+ release :
50+ if : ${{ github.repository == 'viperproject/locate-java-home' && github.ref == 'refs/heads/master' }}
51+ needs : setup-and-test
52+ runs-on : ubuntu-latest
53+ steps :
54+ - name : Checkout repository
55+ uses : actions/checkout@v2
56+
57+ - name : Install Node.js
58+ 59+ with :
60+ node-version : ' 16'
61+
62+ # compare version in package.json with last published version on
63+ # NPM and deploy this version if newer.
64+ # credits go to @fpoli!
65+ - name : Obtain version information
66+ run : |
67+ PACKAGE_NAME="$(cat package.json | jq '.name' --raw-output)"
68+ LAST_PUBLISHED_VERSION="$(
69+ npm show $PACKAGE_NAME version
70+ )"
71+ CURRENT_VERSION="$(
72+ cat package.json | jq '.version' --raw-output
73+ )"
74+ echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV
75+ echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
76+
77+ - name : Cache npm
78+ if : ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
79+ uses : actions/cache@v2
80+ with :
81+ path : .npm
82+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
83+ restore-keys : |
84+ ${{ runner.os }}-node-
85+
86+ - if : ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
87+ run : npm ci --cache .npm --prefer-offline
88+
89+ - name : Release to NPM
90+ if : ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
91+ run : |
92+ npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_ACCESS_TOKEN }}
93+ npm publish --access public
Original file line number Diff line number Diff line change 11{
22 "name" : " @viperproject/locate-java-home" ,
3- "version" : " 1.1.8 " ,
3+ "version" : " 1.1.9 " ,
44 "description" : " Locates JAVA_HOME on any platform, and can differentiate between different versions." ,
55 "main" : " js/es5/index.js" ,
66 "module" : " js/es6/index.js" ,
You can’t perform that action at this time.
0 commit comments