diff --git a/.github/workflows/publish-npm.yaml b/.github/workflows/publish-npm.yaml index fb66f29..28c7350 100644 --- a/.github/workflows/publish-npm.yaml +++ b/.github/workflows/publish-npm.yaml @@ -1,9 +1,8 @@ name: Publish useMultiTabDetection to NPM on: - push: - branches: - - main + release: + types: [published] jobs: publish: @@ -21,7 +20,7 @@ jobs: with: node-version: "20" registry-url: "https://registry.npmjs.org" - + scope: "@tabbridge" - name: Install dependencies run: npm ci @@ -52,6 +51,18 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create package tarball + if: steps.check-version.outputs.skip == 'false' + run: npm pack + + - name: Upload package to release + if: steps.check-version.outputs.skip == 'false' + uses: softprops/action-gh-release@v1 + with: + files: "*.tgz" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Skip publishing if: steps.check-version.outputs.skip == 'true' run: echo "Skipping publish - version already exists on NPM"