Added bash scripts for running and bulding. Fixed github and author_i… #15
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: Test, Build and Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| 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, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./website | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: './website/package-lock.json' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm test | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Run E2E tests | |
| run: npm run test:e2e | |
| build: | |
| name: Build Static Site | |
| runs-on: ubuntu-latest | |
| needs: test | |
| defaults: | |
| run: | |
| working-directory: ./website | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: './website/package-lock.json' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Next.js site | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| - name: Upload build artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./website/out | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| # Only deploy on pushes to main, not on PRs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # CONFIGURATION INSTRUCTIONS: | |
| # | |
| # To enable GitHub Pages deployment, you need to configure your repository settings: | |
| # | |
| # 1. Go to your repository on GitHub | |
| # 2. Click on "Settings" tab | |
| # 3. In the left sidebar, click "Pages" under "Code and automation" | |
| # 4. Under "Build and deployment": | |
| # - Source: Select "GitHub Actions" (NOT "Deploy from a branch") | |
| # 5. Save the settings | |
| # | |
| # After the first successful workflow run, your site will be available at: | |
| # https://<username>.github.io/augmented-coding-patterns/ |