diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..b0a6c7e --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,45 @@ +name: Deploy to Cloudflare Pages + +on: + push: + branches: [master, main] + paths: + - 'web/**' + - '.github/workflows/deploy-pages.yml' + workflow_dispatch: + +jobs: + deploy: + name: Deploy to Cloudflare Pages + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: web/package-lock.json + + - name: Install dependencies + working-directory: web + run: npm ci + + - name: Build + working-directory: web + run: npm run build + + - name: Deploy to Cloudflare Pages + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ai-code-battle + directory: web/dist + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + wranglerVersion: '3'