update pnpm-lock settings #11
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: Build and Publish to NPM | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'pnpm' | |
| cache-dependency-path: 'pnpm-lock.yaml' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Verify version matches tag | |
| run: | | |
| # Extract version from tag (remove 'v' prefix) | |
| TAG_VERSION=${GITHUB_REF#refs/tags/} | |
| TAG_VERSION=${TAG_VERSION#v} | |
| # Get version from package.json | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "Tag version: $TAG_VERSION" | |
| echo "Package version: $PACKAGE_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 verification passed!" | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Build browser bundle | |
| run: pnpm exec webpack --config webpack.config.js | |
| - name: Build CommonJS bundle | |
| run: pnpm exec rollup --config rollup.config.js | |
| - name: Create minified browser bundle | |
| run: pnpm exec webpack --config webpack.config.js --mode production | |
| - name: Publish to NPM | |
| run: pnpm publish --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |