Repository navigation
Publish to npm #16
Workflow file for this run
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: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: npm-publish | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| if: github.repository == 'chenlongapps/opencode-token-usage' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| package-manager-cache: false | |
| - run: npm install --global npm@^11.5.1 | |
| - run: npm ci | |
| - name: Verify release tag | |
| run: node scripts/release.mjs verify-tag | |
| - run: npm run typecheck | |
| - run: npm test | |
| - id: registry | |
| name: Check whether this version is already published | |
| run: node scripts/release.mjs publish-state | |
| - if: steps.registry.outputs.published != 'true' | |
| run: npm publish | |
| - name: Verify npm publication | |
| env: | |
| EXPECT_LATEST: ${{ steps.registry.outputs.published != 'true' }} | |
| run: node scripts/release.mjs verify-published |