docs: in-repo demo image and unversioned unpkg example (#19) #5
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow one concurrent deployment, cancel in-progress runs. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build bundle | |
| run: npm run build | |
| # Assemble the published site: serve the demo at the site root, rewriting | |
| # its relative `../dist/index.js` reference to `./dist/index.js`. | |
| - name: Assemble site | |
| run: | | |
| mkdir -p _site/dist | |
| cp dist/index.js _site/dist/index.js | |
| sed 's#\.\./dist/index.js#./dist/index.js#' examples/index.html > _site/index.html | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v5 | |
| with: | |
| enablement: true | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |