Publish to NPM #1536
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 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 "dummybitcoinjsgabot@example.com" | |
- 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 git@github.com:bitcoinjs/bip44-constants.git | |
- run: git push sshorigin master --tags |