65 lines
1.5 KiB
YAML
65 lines
1.5 KiB
YAML
name: Deploy to Cloudflare Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install
|
|
run: npm ci
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
- name: Run e2e tests
|
|
run: npm run test:e2e
|
|
|
|
deploy:
|
|
needs: e2e
|
|
if: |
|
|
!startsWith(github.event.head_commit.message, 'chore') &&
|
|
!startsWith(github.event.head_commit.message, 'ci') &&
|
|
!startsWith(github.event.head_commit.message, 'tests') &&
|
|
!startsWith(github.event.head_commit.message, 'no-deploy')
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install
|
|
run: npm ci
|
|
|
|
- name: Inject build date
|
|
run: |
|
|
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
|
sed -i "s/__BUILD_DATE__/$BUILD_DATE/" index.html
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Deploy to Cloudflare Pages
|
|
run: |
|
|
npx wrangler pages deploy dist \
|
|
--project-name conceptsketch \
|
|
--branch main
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |