try to fix race condition #13
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: Deploy to Cloudflare Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Deploy to Cloudflare Pages | |
| 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' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.15.0 | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: npx pnpm@9.15.0 install | |
| - name: Build | |
| run: npx pnpm@9.15.0 --filter=@cazala/party build && npx pnpm@9.15.0 --filter=@cazala/playground build | |
| - name: Install Wrangler | |
| run: npm install -g wrangler@3 | |
| - name: Create Cloudflare Pages project if it doesn't exist | |
| run: | | |
| # Set up wrangler authentication | |
| export CLOUDFLARE_API_TOKEN="${{ secrets.CLOUDFLARE_API_TOKEN }}" | |
| export CLOUDFLARE_ACCOUNT_ID="${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" | |
| # Check if project exists, create if it doesn't | |
| if ! wrangler pages project list 2>/dev/null | grep -q "party"; then | |
| echo "Creating Cloudflare Pages project 'party'..." | |
| wrangler pages project create party --production-branch=main || true | |
| else | |
| echo "Project 'party' already exists" | |
| fi | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/pages-action@v1 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| projectName: party | |
| directory: packages/playground/dist | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| wranglerVersion: '3' | |