Skip to content

Commit 041910a

Browse files
authored
Fix deployments when Sentry is not configured (#456)
1 parent 08d3b6d commit 041910a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,28 @@ jobs:
8989
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
9090
command: pages deploy build/client --branch=${{ github.head_ref || github.ref_name }} --project-name=dispoflare
9191

92+
- name: Check for Sentry availability
93+
id: sentry-check
94+
shell: bash
95+
run: |
96+
if [ "${{ secrets.SENTRY_DSN }}" != '' ]; then
97+
echo "sentry=true" >> $GITHUB_OUTPUT;
98+
else
99+
echo "sentry=false" >> $GITHUB_OUTPUT;
100+
fi
101+
102+
- name: Setup Sentry
103+
uses: cloudflare/[email protected]
104+
if: ${{ steps.sentry-check.outputs.sentry == 'true' }}
105+
with:
106+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
107+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
108+
command: --version
109+
secrets: |
110+
SENTRY_DSN
111+
env:
112+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
113+
92114
- name: Publish to Cloudflare Workers
93115
uses: cloudflare/[email protected]
94116
with:
@@ -97,15 +119,14 @@ jobs:
97119
secrets: |
98120
CLOUDFLARE_API_TOKEN
99121
CLOUDFLARE_ACCOUNT_ID
100-
SENTRY_DSN
101122
env:
102123
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
103124
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
104-
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
105125

106126
- name: Create a Sentry release
107127
uses: getsentry/action-release@v1
108128
continue-on-error: true
129+
if: ${{ steps.sentry-check.outputs.sentry == 'true' }}
109130
env:
110131
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
111132
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}

0 commit comments

Comments
 (0)