chore(release): v1.1.2 #8
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 Documentation and Examples to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build package | |
| run: npm run build | |
| - name: Build TypeDoc documentation | |
| run: npm run docs | |
| - name: Build xstate-react example | |
| working-directory: ./examples/xstate-react | |
| env: | |
| VITE_BASE_PATH: /nmea-web-serial/examples/xstate-react/ | |
| run: npm run build | |
| - name: Build xstate-vanilla example | |
| working-directory: ./examples/xstate-vanilla | |
| env: | |
| VITE_BASE_PATH: /nmea-web-serial/examples/xstate-vanilla/ | |
| run: npm run build | |
| - name: Build client-vanilla example | |
| working-directory: ./examples/client-vanilla | |
| env: | |
| VITE_BASE_PATH: /nmea-web-serial/examples/client-vanilla/ | |
| run: npm run build | |
| - name: Prepare GitHub Pages structure | |
| run: | | |
| mkdir -p gh-pages | |
| # Copy TypeDoc documentation to root | |
| cp -r docs/* gh-pages/ | |
| # Copy examples to subdirectories | |
| mkdir -p gh-pages/examples/xstate-react | |
| cp -r examples/xstate-react/dist/* gh-pages/examples/xstate-react/ | |
| mkdir -p gh-pages/examples/xstate-vanilla | |
| cp -r examples/xstate-vanilla/dist/* gh-pages/examples/xstate-vanilla/ | |
| mkdir -p gh-pages/examples/client-vanilla | |
| cp -r examples/client-vanilla/dist/* gh-pages/examples/client-vanilla/ | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "gh-pages" ]; then | |
| echo "Error: gh-pages directory not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "gh-pages/index.html" ]; then | |
| echo "Error: gh-pages/index.html (TypeDoc) not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "gh-pages/examples/xstate-react/index.html" ]; then | |
| echo "Error: xstate-react example not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "gh-pages/examples/xstate-vanilla/index.html" ]; then | |
| echo "Error: xstate-vanilla example not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "gh-pages/examples/client-vanilla/index.html" ]; then | |
| echo "Error: client-vanilla example not found" | |
| exit 1 | |
| fi | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./gh-pages | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |