Release to npm #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release to npm | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 0.8.6)" | |
| required: false | |
| type: string | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| scope: "@crispthinking" | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Set version | |
| run: | | |
| if [[ -n "${{ inputs.version }}" ]]; then | |
| VERSION=${{ inputs.version }} | |
| VERSION=${VERSION#v} | |
| elif [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| TAG_VERSION=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG_VERSION#v} | |
| else | |
| VERSION="0.0.0" | |
| fi | |
| echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV | |
| npm --no-git-tag-version version "$VERSION" | |
| - run: npm ci | |
| - run: npm run codegen | |
| - run: npm run build:release | |
| - name: Publish | |
| run: npm publish --provenance --access public |