Get styling >95% right #28
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 preview from PR | |
| on: | |
| pull_request: | |
| paths: | |
| - 'typescript/**' | |
| - '!typescript/**/*.md' # Exclude markdown files using ! prefix | |
| - '!typescript/README.md' | |
| jobs: | |
| publish-to-pkg-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| working-directory: ./typescript | |
| run: npm ci | |
| - name: Generate types and build package | |
| working-directory: ./typescript | |
| run: | | |
| npm run generate-types | |
| npm run build | |
| - name: Run tests | |
| working-directory: ./typescript | |
| run: npm test | |
| - name: Prepare package for publishing | |
| working-directory: ./typescript | |
| run: | | |
| npm pack | |
| - name: Check package size and create comment | |
| working-directory: ./typescript | |
| run: | | |
| # Run size-limit to get detailed size analysis | |
| SIZE_OUTPUT=$(npm run size 2>&1 || echo "Size check failed") | |
| # Get package file info | |
| PACKAGE_FILE=$(ls *.tgz | head -1) | |
| PACKAGE_SIZE=$(stat -c%s "$PACKAGE_FILE" 2>/dev/null || stat -f%z "$PACKAGE_FILE") | |
| PACKAGE_SIZE_KB=$((PACKAGE_SIZE / 1024)) | |
| # Create comment body | |
| cat > /tmp/size_comment.md << EOF | |
| ## 📦 Package Size Report | |
| **Package:** \`$PACKAGE_FILE\` (${PACKAGE_SIZE_KB} KB compressed) | |
| ### Size Limit Analysis: | |
| \`\`\` | |
| $SIZE_OUTPUT | |
| \`\`\` | |
| Preview package is ready for testing! 🚀 | |
| EOF | |
| # Post comment to PR | |
| gh pr comment --body-file /tmp/size_comment.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: List files in typescript dir | |
| working-directory: ./typescript | |
| run: | | |
| ls -la | |
| - name: Create git symlink | |
| run: ln -s ../.git typescript/.git | |
| # - name: Mv tgz to root | |
| # working-directory: ./typescript | |
| # run: | | |
| # mv *.tgz ../ | |
| - name: List files in root | |
| run: | | |
| ls -la | |
| - name: Publish preview | |
| working-directory: ./typescript | |
| run: npx pkg-pr-new publish |