Add reasoning effort selection and streaming responses (#21) #32
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: Publish to NPM | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check-version: | |
| name: Check if version changed | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.check.outputs.changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check if version is already published | |
| id: check | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| echo "package=$PACKAGE_NAME" | |
| echo "version=$CURRENT_VERSION" | |
| if npm view "${PACKAGE_NAME}@${CURRENT_VERSION}" version 2>/dev/null; then | |
| echo "Version $CURRENT_VERSION already published" | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version $CURRENT_VERSION not yet published" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| publish: | |
| name: Publish package | |
| runs-on: ubuntu-latest | |
| needs: check-version | |
| if: needs.check-version.outputs.changed == 'true' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| # actions/setup-node resolves a semver-compatible Node 24 release, which may | |
| # bundle an npm CLI older than the minimum required for OIDC trusted publishing. | |
| - name: Ensure npm CLI supports trusted publishing | |
| run: | | |
| npm install -g npm@^11.5.1 | |
| NPM_VERSION=$(npm --version) | |
| echo "Using npm $NPM_VERSION for trusted publishing" | |
| node -e ' | |
| const current = process.argv[1].split(".").map(Number); | |
| const minimum = [11, 5, 1]; | |
| for (let i = 0; i < minimum.length; i += 1) { | |
| const actual = current[i] ?? 0; | |
| const required = minimum[i]; | |
| if (actual > required) { | |
| process.exit(0); | |
| } | |
| if (actual < required) { | |
| console.error( | |
| `npm ${process.argv[1]} does not meet the trusted publishing minimum of ${minimum.join(".")}.`, | |
| ); | |
| process.exit(1); | |
| } | |
| } | |
| ' "$NPM_VERSION" | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Validate environment variables | |
| env: | |
| GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
| GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
| run: | | |
| if [ -z "$GOOGLE_CLIENT_ID" ]; then | |
| echo "Error: GOOGLE_CLIENT_ID secret is not set." | |
| exit 1 | |
| fi | |
| if [ -z "$GOOGLE_CLIENT_SECRET" ]; then | |
| echo "Error: GOOGLE_CLIENT_SECRET secret is not set." | |
| exit 1 | |
| fi | |
| - name: Build project | |
| env: | |
| GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
| GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
| run: pnpm run build | |
| - name: Publish to NPM | |
| run: | | |
| unset NODE_AUTH_TOKEN | |
| npm publish --access public --provenance |