chore: release main (#20) #52
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: Deploy Demo App | |
| on: | |
| # Only runs on pushes targeting main branch for demo-related changes | |
| # Excludes pushes that would trigger releases (handled by release.yml) | |
| push: | |
| branches: ['main'] | |
| paths: | |
| - 'demo/**' | |
| - 'src/**' | |
| - 'index.html' | |
| - 'vite.config.ts' | |
| - 'tailwind.config.js' | |
| - '.github/workflows/deploy-demo.yml' | |
| # Allows manual deployment | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: false | |
| jobs: | |
| # Only deploy if this is not a release commit | |
| check-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_deploy: ${{ steps.check.outputs.should_deploy }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check if this is a release commit | |
| id: check | |
| run: | | |
| # Check if this commit message indicates a release | |
| if [[ "${{ github.event.head_commit.message }}" =~ ^chore\(main\):\ release ]]; then | |
| echo "should_deploy=false" >> $GITHUB_OUTPUT | |
| echo "This is a release commit, skipping demo deployment (handled by release workflow)" | |
| else | |
| echo "should_deploy=true" >> $GITHUB_OUTPUT | |
| echo "This is not a release commit, proceeding with demo deployment" | |
| fi | |
| # Build and deploy demo | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: check-release | |
| if: needs.check-release.outputs.should_deploy == 'true' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| # Clean install to avoid cached native bindings issues | |
| rm -rf node_modules package-lock.json | |
| npm install | |
| - name: Verify SWC installation | |
| run: | | |
| # Reinstall SWC to ensure correct native bindings | |
| npm install --no-save @swc/core @swc/helpers | |
| - name: Build library | |
| run: npm run build:lib | |
| - name: Build demo | |
| run: npm run build:demo | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist-demo' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |