Backward compatibility fix. #26
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
name: Publish packages to npm | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
ref: ${{ github.ref }} | |
submodules: true | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12 | |
registry-url: https://registry.npmjs.org/ | |
- name: Publish packages | |
run: | | |
set -e | |
extract() { | |
# Field's key/value should be on their own line | |
echo $(cat package.json \ | |
| grep "$1" \ | |
| head -1 \ | |
| awk -F: '{ print $2 }' \ | |
| sed 's/[",]//g') | |
} | |
PACKAGE_NAME=$(extract name) | |
PACKAGE_VERSION=$(extract version) | |
NPM_VERSION=$(npm view "$PACKAGE_NAME" version) | |
if [ "$NPM_VERSION" != "$PACKAGE_VERSION" ] | |
then | |
npm publish --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |