diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8f4711..7401cfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,12 @@ on: pull_request: release: types: [published] + workflow_dispatch: + inputs: + prerelease: + description: 'Publish as prerelease (alpha tag). Version must already be bumped in package.json on the branch.' + type: boolean + default: false permissions: contents: read @@ -31,7 +37,7 @@ jobs: publish: runs-on: ubuntu-latest - if: github.event_name == 'release' + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true') environment: release needs: [test] @@ -48,6 +54,11 @@ jobs: registry-url: 'https://registry.npmjs.org' - run: npm ci - - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to npm + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + npm publish --access public --tag alpha + else + npm publish --access public + fi