0.3.2 #5
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: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Triggers on version tags like v1.0.0, v1.2.3, etc. | |
| jobs: | |
| build-and-test: | |
| name: Build and Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Lint | |
| run: npm run lint | |
| - name: Run tests | |
| run: npm test | |
| - name: Build | |
| run: npm run build | |
| - name: Verify build output | |
| shell: bash | |
| run: | | |
| if [ ! -f "dist/index.js" ]; then | |
| echo "Build failed - dist/index.js not found" | |
| exit 1 | |
| fi | |
| echo "Build successful - dist/index.js exists" | |
| publish: | |
| name: Publish to npm | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for npm provenance | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Verify package.json version matches tag | |
| shell: bash | |
| run: | | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then | |
| echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version check passed: $PACKAGE_VERSION" | |
| - name: Publish to npm | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| generate_release_notes: true | |
| body: | | |
| ## Installation | |
| ```bash | |
| npm install -g @standardbeagle/dart-query | |
| ``` | |
| ## What's Changed | |
| See full changelog in commits below. | |
| ## Documentation | |
| - [README](https://github.com/standardbeagle/dart-query#readme) | |
| - [Tool Documentation](https://github.com/standardbeagle/dart-query/blob/main/TOOLS.md) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |