Code cleanup #55
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: Cloudflare Wrangler Deploy | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: Build and Test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- run: npm ci | |
- run: npm run build --if-present | |
- run: npm test | |
- uses: actions/upload-artifact@v4 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: test-results | |
path: junit-report.xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
beta-deploy: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.event_name == 'push' | |
name: Deploy to Beta | |
environment: beta | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
command: deploy --env beta | |
prod-deploy: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.event_name == 'release' | |
name: Deploy to PROD | |
strategy: | |
matrix: | |
environment: ['public', 'eus1', 'eus2'] | |
environment: ${{ matrix.environment }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
command: deploy --env ${{ matrix.environment }} |