From e46d4c7e0681484798664202dccc09edafb036b1 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Tue, 23 Apr 2024 14:35:38 +0300 Subject: [PATCH] Add publish-npm script --- .github/workflows/publish-npm.yml | 46 +++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 31 --------------------- 2 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/publish-npm.yml delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..52f122e --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,46 @@ +name: Publish sdk-web-wallet-cross-window-provider + +on: + push: + branches: [main] + repository_dispatch: + types: publish-npm + workflow_dispatch: + +permissions: + contents: write + +jobs: + publish-npm: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v1 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run compile + + - name: Get package info + id: package + uses: andreigiura/action-nodejs-package-info@v1.0.2 + + - name: Publish to npmjs next version + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.package.outputs.is-prerelease == 'true'}} + run: echo ${{ steps.package.outputs.is-prerelease}} && cd dist && npm publish --tag next + + - name: Publish to npmjs + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.package.outputs.is-prerelease == 'false' }} + run: cd dist && npm publish diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 700fa12..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - -permissions: - contents: write - -jobs: - publish-npm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 16 - registry-url: https://registry.npmjs.org/ - - - run: npm ci - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - RELEASE_TAG=v$(node -p "require('./package.json').version") - gh release create $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes - - - name: Publish to npmjs - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - run: npm publish --access=public