From b3199a624b1cf04d028aeb07bb1da24b733cb364 Mon Sep 17 00:00:00 2001 From: Miguel Naveira <47919901+mrnaveira@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:59:43 +0100 Subject: [PATCH] chore: add github workflow for npm publish (#1073) Description --- Added a new github CI action to automatically publish to npm registry on every version change:: * TypeScript bindings * Wallet daemon client Motivation and Context --- The `typescript-bindings` and the `wallet-daemon-client` npm packages are used by multiple projects. We want to automatically publish their latest versions to the [NPM registry](https://www.npmjs.com/) when the package versions increases. This way dependent projects can directly include the npm dependency for them. How Has This Been Tested? --- In progress What process can a PR reviewer use to test or verify this change? --- Testing in progress Breaking Changes --- - [x] None - [ ] Requires data directory to be deleted - [ ] Other - Please specify --- .github/workflows/npm_publish.yml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/npm_publish.yml diff --git a/.github/workflows/npm_publish.yml b/.github/workflows/npm_publish.yml new file mode 100644 index 000000000..c880ad205 --- /dev/null +++ b/.github/workflows/npm_publish.yml @@ -0,0 +1,48 @@ +--- +# Publishing all NPM packages to the npm registry when the version number changes +# See https://github.com/marketplace/actions/npm-publish for more information +name: Publish Packages to npmjs + +on: + push: + branches: development + +jobs: + # Publish the TypeScript bindings to the NPM registry + publish-typescript-bindings: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./bindings + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: "20" + - run: npm ci + - uses: JS-DevTools/npm-publish@v3 + id: publish + with: + token: ${{ secrets.NPM_TOKEN }} + - if: ${{ steps.publish.outputs.type }} + run: echo "Published to NPM registry '${{ steps.publish.outputs.name }}' version '${{ steps.publish.outputs.version }}'" + + # Publish the Tari Wallet Daemon client to the NPM registry + publish-wallet-daemon-client: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./clients/javascript/wallet_daemon_client + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: "20" + - run: npm ci + - uses: JS-DevTools/npm-publish@v3 + id: publish + with: + token: ${{ secrets.NPM_TOKEN }} + - if: ${{ steps.publish.outputs.type }} + run: echo "Published to NPM registry '${{ steps.publish.outputs.name }}' version '${{ steps.publish.outputs.version }}'" +