chiro-canto/public/scripts/wavesurfer/.github/workflows/publish.yml

37 lines
1.0 KiB
YAML

name: NPM Package
on:
push:
branches: [ master ]
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: Cache Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- run: npm install
- name: Tag & publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
run: |
OLD_VERSION=$(npm show wavesurfer.js version)
NEW_VERSION=$(node -p 'require("./package.json").version')
if [ $NEW_VERSION != $OLD_VERSION ]; then
git tag "$NEW_VERSION"
git push --tags
npm publish
fi