Skip to content

add staging env

add staging env #53

Workflow file for this run

name: Node.js CI

Check failure on line 1 in .github/workflows/node.js.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/node.js.yml

Invalid workflow file

Invalid type for `job.environment`
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm test
deploy:
runs-on: ubuntu-latest
needs: test
environment: {{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
steps:
- uses: actions/checkout@v4
- name: Deploy
run: {{ github.ref == 'refs/heads/main' && 'npx wrangler deploy' || ' npx wranger deploy -e staging' }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}