|
| 1 | +name: Deploy to GitHub Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: 'pages' |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup pnpm |
| 26 | + uses: pnpm/action-setup@v3 |
| 27 | + with: |
| 28 | + version: 10.8.0 |
| 29 | + |
| 30 | + - name: Setup Node |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: '20' |
| 34 | + cache: 'pnpm' |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: pnpm install |
| 38 | + |
| 39 | + - name: Build and Static Export |
| 40 | + run: pnpm export |
| 41 | + |
| 42 | + - name: Create .nojekyll file |
| 43 | + run: touch out/.nojekyll |
| 44 | + |
| 45 | + - name: List output directory (for debugging) |
| 46 | + run: ls -la out/ |
| 47 | + |
| 48 | + - name: Setup Pages |
| 49 | + uses: actions/configure-pages@v4 |
| 50 | + with: |
| 51 | + static_site_generator: next |
| 52 | + |
| 53 | + - name: Upload artifact |
| 54 | + uses: actions/upload-pages-artifact@v3 |
| 55 | + with: |
| 56 | + path: ./out |
| 57 | + |
| 58 | + deploy: |
| 59 | + environment: |
| 60 | + name: github-pages |
| 61 | + url: ${{ steps.deployment.outputs.page_url }} |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: build |
| 64 | + steps: |
| 65 | + - name: Deploy to GitHub Pages |
| 66 | + id: deployment |
| 67 | + uses: actions/deploy-pages@v4 |
| 68 | + |
| 69 | + browserstack-test: |
| 70 | + name: 'Run BrowserStack Playwright Tests' |
| 71 | + runs-on: ubuntu-latest |
| 72 | + needs: build |
| 73 | + steps: |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Setup pnpm |
| 78 | + uses: pnpm/action-setup@v3 |
| 79 | + with: |
| 80 | + version: 10.8.0 |
| 81 | + |
| 82 | + - name: Setup Node |
| 83 | + uses: actions/setup-node@v4 |
| 84 | + with: |
| 85 | + node-version: '20' |
| 86 | + cache: 'pnpm' |
| 87 | + |
| 88 | + - name: Install dependencies |
| 89 | + run: pnpm install |
| 90 | + |
| 91 | + - name: Install Playwright browsers |
| 92 | + run: pnpm exec playwright install --with-deps |
| 93 | + |
| 94 | + - name: 'BrowserStack Env Setup' |
| 95 | + uses: 'browserstack/github-actions/setup-env@master' |
| 96 | + with: |
| 97 | + username: ${{ secrets.BROWSERSTACK_USERNAME }} |
| 98 | + access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
| 99 | + build-name: Browserstack Demo |
| 100 | + project-name: browserstack-integration-template |
| 101 | + |
| 102 | + - name: Run Playwright tests on BrowserStack |
| 103 | + run: pnpm test:browserstack |
0 commit comments