Skip to content

Publish to NPM

Publish to NPM #2044

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 * * *'
permissions:
id-token: write
contents: read
jobs:
publish-npm:
runs-on: ubuntu-latest
environment: 'Publish NPM'
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
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
- run: git remote add sshorigin [email protected]:bitcoinjs/bip44-constants.git
- run: git push sshorigin master --tags