deploy: test #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: Astro CI/CD with Playwright & Cloudflare Pages | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test-and-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_VERSION: 20 | |
| steps: | |
| - name: ⬇️ Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: 🟢 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 🔧 Enable Corepack | |
| run: corepack enable | |
| - name: 📥 Install pnpm | |
| run: corepack prepare [email protected] --activate | |
| - name: 📦 Install dependencies | |
| run: pnpm install | |
| - name: 🎭 Install Playwright browsers | |
| run: pnpm exec playwright install --with-deps | |
| - name: ✅ Run Playwright tests | |
| run: pnpm exec playwright test | |
| - name: 🛠️ Build Astro | |
| run: pnpm run build | |
| - name: 🚀 Deploy to Cloudflare Pages | |
| uses: cloudflare/pages-action@v1 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} | |
| directory: ./dist | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} |