Fix claim API build error #61
This file contains 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 Worker and Run Cypress Tests | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build Worker | |
run: npm run worker:build | |
- name: Deploy to Cloudflare | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
run: npm run worker:deploy | |
- name: Wait for deployment | |
run: sleep 120 | |
- name: Run Cypress tests | |
id: cypress | |
run: npx cypress run --config-file cypress.config.js --record --key ${{ secrets.CYPRESS_RECORD_KEY }} | |
continue-on-error: true | |
- name: Send email notification on failure | |
if: steps.cypress.outcome == 'failure' | |
run: | | |
curl -X POST 'https://api.resend.com/emails' \ | |
-H 'Authorization: Bearer ${{ secrets.RESEND_API_KEY }}' \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"from": "Cypress Tests <support@miataregistry.com>", | |
"to": ["mattcongrove@gmail.com"], | |
"subject": "❌ Cypress Tests Failed", | |
"text": "Cypress tests failed in the deployment workflow.\n\nView the test results here: https://cloud.cypress.io/projects/ygesqc/runs/${{ env.CYPRESS_RUN_ID }}" | |
}' | |
- name: Exit with Cypress status | |
if: steps.cypress.outcome == 'failure' | |
run: exit 1 |