Skip to content

Publish to NPM

Publish to NPM #1657

Workflow file for this run

name: Publish to NPM
on:
schedule:
# * is a special character in YAML so you have to quote this string
# Run once per day at 02:42 UTC
- cron: '42 2 * * *'
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install && rm package-lock.json
- run: node update.js > new_index.js
- run: if ! [[ $(diff new_index.js index.js) ]]; then echo "No updates." 1>&2; exit 1; fi
- run: mv new_index.js index.js
- run: npm test
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Github Actions"
- run: git commit -am "Update index.js"
- run: npm version major
- run: mkdir -p ~/.ssh
- run: echo "${{secrets.deploy_key}}" > ~/.ssh/id_rsa
- run: chmod 600 ~/.ssh/id_rsa
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_auto_key }}
- run: git remote add sshorigin [email protected]:bitcoinjs/bip44-constants.git
- run: git push sshorigin master --tags