Merge pull request #123 from petera2c/feat/angular-vanilla-row-data-g… #287
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: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| tests: | |
| uses: ./.github/workflows/test.yml | |
| verify-examples: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build all example apps | |
| run: pnpm run build:examples | |
| publish: | |
| needs: [tests, verify-examples] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # ─── simple-table-core ─────────────────────────────────────────────────── | |
| - name: "[core] Check version needs publishing" | |
| id: core-check | |
| working-directory: packages/core | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[core] Build Storybook" | |
| if: steps.core-check.outputs.changed == 'true' | |
| working-directory: packages/core | |
| run: pnpm run build-storybook | |
| - name: "[core] Install Playwright" | |
| if: steps.core-check.outputs.changed == 'true' | |
| working-directory: packages/core | |
| run: | | |
| pnpm exec playwright install --with-deps chromium | |
| npm install -g concurrently http-server wait-on | |
| - name: "[core] Serve Storybook and run tests" | |
| if: steps.core-check.outputs.changed == 'true' | |
| working-directory: packages/core | |
| run: | | |
| concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
| "http-server storybook-static --port 6006 --silent" \ | |
| "wait-on --timeout 60000 http://localhost:6006 && pnpm run test-storybook:ci" | |
| - name: "[core] Build" | |
| if: steps.core-check.outputs.changed == 'true' | |
| run: pnpm run build:core | |
| - name: "[core] Publish" | |
| if: steps.core-check.outputs.changed == 'true' | |
| working-directory: packages/core | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --access public --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --access public --provenance | |
| fi | |
| - name: "[core] Create Git tag" | |
| if: steps.core-check.outputs.changed == 'true' | |
| run: | | |
| TAG="simple-table-core@${{ steps.core-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── @simple-table/react ───────────────────────────────────────────────── | |
| - name: "[react] Check version needs publishing" | |
| id: react-check | |
| working-directory: packages/react | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[react] Build" | |
| if: steps.react-check.outputs.changed == 'true' | |
| run: pnpm run build:react | |
| - name: "[react] Publish" | |
| if: steps.react-check.outputs.changed == 'true' | |
| working-directory: packages/react | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --provenance | |
| fi | |
| - name: "[react] Create Git tag" | |
| if: steps.react-check.outputs.changed == 'true' | |
| run: | | |
| TAG="@simple-table/react@${{ steps.react-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── @simple-table/vue ─────────────────────────────────────────────────── | |
| - name: "[vue] Check version needs publishing" | |
| id: vue-check | |
| working-directory: packages/vue | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[vue] Build" | |
| if: steps.vue-check.outputs.changed == 'true' | |
| run: pnpm run build:vue | |
| - name: "[vue] Publish" | |
| if: steps.vue-check.outputs.changed == 'true' | |
| working-directory: packages/vue | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --provenance | |
| fi | |
| - name: "[vue] Create Git tag" | |
| if: steps.vue-check.outputs.changed == 'true' | |
| run: | | |
| TAG="@simple-table/vue@${{ steps.vue-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── @simple-table/svelte ──────────────────────────────────────────────── | |
| - name: "[svelte] Check version needs publishing" | |
| id: svelte-check | |
| working-directory: packages/svelte | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[svelte] Build" | |
| if: steps.svelte-check.outputs.changed == 'true' | |
| run: pnpm run build:svelte | |
| - name: "[svelte] Publish" | |
| if: steps.svelte-check.outputs.changed == 'true' | |
| working-directory: packages/svelte | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --provenance | |
| fi | |
| - name: "[svelte] Create Git tag" | |
| if: steps.svelte-check.outputs.changed == 'true' | |
| run: | | |
| TAG="@simple-table/svelte@${{ steps.svelte-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── @simple-table/solid ───────────────────────────────────────────────── | |
| - name: "[solid] Check version needs publishing" | |
| id: solid-check | |
| working-directory: packages/solid | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[solid] Build" | |
| if: steps.solid-check.outputs.changed == 'true' | |
| run: pnpm run build:solid | |
| - name: "[solid] Publish" | |
| if: steps.solid-check.outputs.changed == 'true' | |
| working-directory: packages/solid | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --provenance | |
| fi | |
| - name: "[solid] Create Git tag" | |
| if: steps.solid-check.outputs.changed == 'true' | |
| run: | | |
| TAG="@simple-table/solid@${{ steps.solid-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── @simple-table/angular ─────────────────────────────────────────────── | |
| - name: "[angular] Check version needs publishing" | |
| id: angular-check | |
| working-directory: packages/angular | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| NAME=$(node -p "require('./package.json').name") | |
| # Look up the exact version on npm. Empty result means it is not | |
| # published yet, so we publish. This covers both a freshly bumped | |
| # version and retrying after a previously failed launch. | |
| PUBLISHED=$(npm view "$NAME@$CURRENT" version 2>/dev/null || echo "") | |
| if [ "$PUBLISHED" != "$CURRENT" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "version=$CURRENT" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[angular] Build" | |
| if: steps.angular-check.outputs.changed == 'true' | |
| run: pnpm run build:angular | |
| - name: "[angular] Publish" | |
| if: steps.angular-check.outputs.changed == 'true' | |
| working-directory: packages/angular | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *"-"* ]]; then | |
| TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/') | |
| pnpm publish --no-git-checks --provenance --tag "$TAG" | |
| else | |
| pnpm publish --no-git-checks --provenance | |
| fi | |
| - name: "[angular] Create Git tag" | |
| if: steps.angular-check.outputs.changed == 'true' | |
| run: | | |
| TAG="@simple-table/angular@${{ steps.angular-check.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Idempotent: skip if the tag already exists on origin (e.g. when a | |
| # prior run published but failed before/after tagging). | |
| if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG"; then | |
| echo "Tag $TAG already exists on origin, skipping." | |
| else | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ─── StackBlitz examples ───────────────────────────────────────────────── | |
| - name: "[stackblitz] Check if any package was published" | |
| id: any-published | |
| run: | | |
| if [[ "${{ steps.core-check.outputs.changed }}" == "true" ]] || \ | |
| [[ "${{ steps.react-check.outputs.changed }}" == "true" ]] || \ | |
| [[ "${{ steps.vue-check.outputs.changed }}" == "true" ]] || \ | |
| [[ "${{ steps.svelte-check.outputs.changed }}" == "true" ]] || \ | |
| [[ "${{ steps.solid-check.outputs.changed }}" == "true" ]] || \ | |
| [[ "${{ steps.angular-check.outputs.changed }}" == "true" ]]; then | |
| echo "published=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "published=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: "[stackblitz] Generate examples" | |
| if: steps.any-published.outputs.published == 'true' | |
| run: node scripts/generate-stackblitz.mjs | |
| - name: "[stackblitz] Deploy to branch" | |
| if: steps.any-published.outputs.published == 'true' | |
| run: | | |
| cd stackblitz-examples | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b stackblitz-examples | |
| git add -A | |
| git commit -m "Update StackBlitz examples ($(date -u +%Y-%m-%dT%H:%M:%SZ))" | |
| git push -f "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}" HEAD:stackblitz-examples | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |