chore(release): v0.3.0 #20
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 CLI to npm | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (skip actual publish)' | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| name: Publish to npm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm --filter @profullstack/threatcrush build | |
| - name: Check if version exists | |
| id: check | |
| working-directory: apps/cli | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if npm view "@profullstack/threatcrush@$VERSION" version 2>/dev/null; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION already published, skipping." | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish CLI | |
| if: ${{ !github.event.inputs.dry_run && steps.check.outputs.exists != 'true' }} | |
| working-directory: apps/cli | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Dry run | |
| if: ${{ github.event.inputs.dry_run }} | |
| working-directory: apps/cli | |
| run: npm publish --access public --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Summary | |
| if: always() | |
| env: | |
| ALREADY_PUBLISHED: ${{ steps.check.outputs.exists }} | |
| DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | |
| run: | | |
| VERSION=$(node -p "require('./apps/cli/package.json').version") | |
| echo "## npm Publish Summary" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Package**: @profullstack/threatcrush" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Version**: $VERSION" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Already published**: $ALREADY_PUBLISHED" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Dry Run**: $DRY_RUN" >> "$GITHUB_STEP_SUMMARY" |