Bump semver from 7.6.0 to 7.6.2 #305
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
# | |
# Copyright (c) 2011-2020 ETH Zurich. | |
name: test | |
on: | |
push: # run this workflow on every push | |
pull_request: # run this workflow on every pull_request | |
jobs: | |
setup-and-test: | |
name: setup-and-test - ${{ matrix.os }} | |
strategy: | |
# tests should not be stopped when they fail on one of the OSes: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v1.4.4 | |
with: | |
node-version: '16' | |
- name: Setup Java JDK | |
uses: actions/setup-java@v1.4.3 | |
with: | |
java-version: '11' | |
- run: java --version | |
- name: Cache npm | |
uses: actions/cache@v2 | |
with: | |
path: .npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: npm ci --cache .npm --prefer-offline | |
- name: Run tests | |
run: npm test | |
release: | |
if: ${{ github.repository == 'viperproject/locate-java-home' && github.ref == 'refs/heads/master' }} | |
needs: setup-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v1.4.4 | |
with: | |
node-version: '16' | |
# compare version in package.json with last published version on | |
# NPM and deploy this version if newer. | |
# credits go to @fpoli! | |
- name: Obtain version information | |
run: | | |
PACKAGE_NAME="$(cat package.json | jq '.name' --raw-output)" | |
LAST_PUBLISHED_VERSION="$( | |
npm show $PACKAGE_NAME version | |
)" | |
CURRENT_VERSION="$( | |
cat package.json | jq '.version' --raw-output | |
)" | |
echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV | |
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV | |
- name: Cache npm | |
if: ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }} | |
uses: actions/cache@v2 | |
with: | |
path: .npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- if: ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }} | |
run: npm ci --cache .npm --prefer-offline | |
- name: Release to NPM | |
if: ${{ env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }} | |
run: | | |
npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_ACCESS_TOKEN }} | |
npm publish --access public |