Update README.md #20
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
| # .github/workflows/deploy.yml | |
| name: Deploy Astro site to Pages | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| # This permission is essential for deploying to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Prevent multiple workflows from running at the same time for the same branch | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 # Updated from v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 # Updated from v3 | |
| with: | |
| # Use the Node.js version from your project's .nvmrc or package.json | |
| # This is better than hardcoding the version | |
| node-version-file: 'package.json' | |
| cache: 'npm' # Add caching for faster installs | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 # Updated from v1 | |
| with: | |
| path: dist | |
| 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 # Updated from v1 |