diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..65d2f58 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +on: + release: + types: [created, edited, published] + workflow_dispatch: + inputs: + dryRun: + description: "Dry run only" + required: true + default: true + type: boolean + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 20 + registry-url: "https://registry.npmjs.org" + - run: npm ci + + - name: Publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }} + if: > + (github.event_name == 'release' && github.event.action == 'published') || + (github.event_name == 'workflow_dispatch' && !inputs.dryRun) + run: npm publish + + - name: Publish package (dry run) + env: + NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }} + if: > + (github.event_name == 'release' && github.event.action != 'published') || + (github.event_name == 'workflow_dispatch' && inputs.dryRun) + run: npm publish --dry-run diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d30ccf7..5be7396 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,6 @@ on: push: branches: - - master - main pull_request: