chore: Bump version to 1.5.4 and enhance package metadata for improve… #9
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*.*.*' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Validate tag format | |
| id: tag-info | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| # Remove 'v' prefix for version comparison | |
| VERSION=${TAG#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Validate semantic versioning format | |
| if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$ ]]; then | |
| echo "Error: Tag must follow semantic versioning (e.g., v1.0.0)" | |
| exit 1 | |
| fi | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.18.3 | |
| - 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: Verify package.json version matches tag | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package/package.json').version") | |
| TAG_VERSION="${{ steps.tag-info.outputs.version }}" | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| echo "✅ Version validation passed: $PACKAGE_VERSION" | |
| - name: Verify CHANGELOG entry exists | |
| run: | | |
| TAG_VERSION="${{ steps.tag-info.outputs.version }}" | |
| if ! grep -q "## \[$TAG_VERSION\]" CHANGELOG.md && ! grep -q "## $TAG_VERSION" CHANGELOG.md; then | |
| echo "⚠️ Warning: No CHANGELOG entry found for version $TAG_VERSION" | |
| echo "Please update CHANGELOG.md before publishing" | |
| exit 1 | |
| fi | |
| echo "✅ CHANGELOG entry found for version $TAG_VERSION" | |
| - name: Run linter | |
| run: pnpm --filter tryless lint | |
| - name: Check types | |
| run: pnpm --filter tryless exec tsc --noEmit | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: echo "version=$(pnpm --filter tryless list @playwright/test --depth=0 --json | jq -r '.[0].version')" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm --filter tryless exec playwright install --with-deps chromium | |
| - name: Install Playwright system dependencies | |
| if: steps.playwright-cache.outputs.cache-hit == 'true' | |
| run: pnpm --filter tryless exec playwright install-deps chromium | |
| - name: Build package | |
| run: pnpm --filter tryless build | |
| - name: Run tests | |
| run: pnpm --filter tryless test | |
| - name: Copy README to package | |
| run: cp README.md package/README.md | |
| - name: Verify package contents | |
| working-directory: ./package | |
| run: | | |
| echo "📦 Package contents:" | |
| ls -la | |
| echo "" | |
| echo "📄 Dist files:" | |
| ls -la dist/ | |
| echo "" | |
| if [ ! -f "README.md" ]; then | |
| echo "Error: README.md not found in package directory" | |
| exit 1 | |
| fi | |
| - name: Publish to NPM | |
| working-directory: ./package | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| body: | | |
| ## 🎉 Changes in this Release | |
| See the [CHANGELOG](https://github.com/jordyfontoura/tryless/blob/main/CHANGELOG.md) for details. | |
| ## 📦 Installation | |
| ```bash | |
| npm install tryless@${{ steps.tag-info.outputs.version }} | |
| ``` | |
| ## 📚 Documentation | |
| [View full documentation](https://github.com/jordyfontoura/tryless#readme) | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |