1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| name: Deploy to Cloudflare Pages
on: push: branches: - master - pre - test
jobs: build-and-deploy: runs-on: ubuntu-latest
steps: - name: Checkout source repository uses: actions/checkout@v3
- name: Set up Node.js uses: actions/setup-node@v3 with: node-version: '18.19.0'
- name: Install pnpm run: npm install -g pnpm
- name: Install wrangler cli run: npm install -g wrangler
- name: Install dependencies run: pnpm install
- name: Set up Cloudflare token run: | echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Build the app (Production) if: github.ref == 'refs/heads/master' run: | pnpm run build wrangler pages deploy ./dist --branch main --project-name=production-project-name
- name: Build the app (Preview) if: github.ref == 'refs/heads/pre' run: | pnpm run build:pre wrangler pages deploy ./dist --branch main --project-name=preview-project-name
- name: Build the app (Testing) if: github.ref == 'refs/heads/test' run: | pnpm run build:test wrangler pages deploy ./dist --branch main --project-name=testing-project-name
|