iotdb sql parser v1.0.0 #2
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
| # This workflow will publish the package to npm when a release is created | |
| name: Publish to npm | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # 确保获取完整的 git 历史,用于版本管理 | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4.0.0 | |
| with: | |
| version: 9.7.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run type check | |
| run: pnpm check-types | |
| - name: Run tests | |
| run: pnpm test | |
| - name: Build package | |
| run: pnpm build | |
| - name: Update version (if manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| npm version ${{ github.event.inputs.version_type }} --no-git-tag-version | |
| git add package.json | |
| git commit -m "chore: bump version to $(node -p "require('./package.json').version")" | |
| git push | |
| - name: Publish to npm | |
| run: pnpm publish --access public --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create Git tag (if manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| git tag "v$VERSION" | |
| git push origin "v$VERSION" |