-
-
Notifications
You must be signed in to change notification settings - Fork 37
61 lines (50 loc) · 1.82 KB
/
production-workflow.yml
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 Production
on:
push:
branches:
- production
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v3
with:
fetch-depth: 0 # Get the full history for the Sentry release commit log
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
- name: Prepare Wrangler Config
run: |
SENTRY_DSN=$(printf '%s\n' "${{ secrets.SENTRY_DSN }}" | sed -e 's/[\/&]/\\&/g')
sed -i "s/SENTRY_DSN = \"\"/SENTRY_DSN = \"$SENTRY_DSN\"/g" wrangler.toml
SENTRY_RELEASE=$(printf '%s\n' "${{ github.sha }}" | sed -e 's/[\/&]/\\&/g')
sed -i "s/SENTRY_RELEASE = \"\"/SENTRY_RELEASE = \"$SENTRY_RELEASE\"/g" wrangler.toml
- name: Deploy to Production
run: npx wrangler deploy --env production --outdir dist-worker --minify
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN_PRODUCTION }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID_PRODUCTION }}
- name: Prepare Sentry Release
run: |
mv dist-worker/index.js dist-worker/worker.js
mv dist-worker/index.js.map dist-worker/worker.js.map
- name: Create Sentry Release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
url_prefix: /
ignore_missing: true
ignore_empty: true
version: ${{ github.sha }}
environment: production
sourcemaps: dist-worker