Merge pull request #15 from ihatexcel/claude/setup-tsup-github-lib-KNfOE #53
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, Test & Deploy | |
| on: | |
| push: | |
| branches: [main, 'claude/**', 'feat/**', 'fix/**'] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Only one Pages deployment at a time | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| # ───────────────────────────────────────────────────────────── | |
| # 1. Build & test | |
| # ───────────────────────────────────────────────────────────── | |
| build: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| - name: Run tests | |
| run: npm test -- --reporter=verbose | |
| - name: Build library | |
| run: npm run build | |
| # Upload dist as downloadable artifact (30-day retention) | |
| - name: Upload dist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: iframe-flight-dist-${{ github.sha }} | |
| path: dist/ | |
| retention-days: 30 | |
| # ── Assemble Pages site ────────────────────────────────── | |
| # Structure: docs/ + IIFE (legacy) + ESM (used by demo pages via import map) | |
| - name: Assemble GitHub Pages site | |
| run: | | |
| mkdir -p _site | |
| cp docs/index.html _site/index.html | |
| cp docs/child.html _site/child.html | |
| cp docs/child-simple.html _site/child-simple.html | |
| cp docs/child-chart.html _site/child-chart.html | |
| cp docs/embed.html _site/embed.html | |
| cp dist/index.iife.js _site/iframe-flight.iife.js | |
| cp dist/index.js _site/iframe-flight.esm.js | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site/ | |
| # ───────────────────────────────────────────────────────────── | |
| # 2. Deploy to GitHub Pages | |
| # Runs on every push (all branches), so you can preview | |
| # your branch at https://ihatexcel.github.io/iframe-flight/ | |
| # Note: Pages always shows the last successful deployment. | |
| # ───────────────────────────────────────────────────────────── | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| runs-on: ubuntu-latest | |
| # Only deploy on push to main | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deploy | |
| uses: actions/deploy-pages@v4 |