diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f7754929358..cc2bd97cb89 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -183,7 +183,7 @@ jobs: with: # The Sentry auth token is only set for the production release of the frontend (on push to main or manual release). secrets: | - "sentry_auth_token=${{ matrix.image == 'frontend' && ((github.event_name == 'push' && github.repository == 'WordPress/openverse') ||(github.event_name == 'workflow_dispatch' && inputs.perform_deploy)) && secrets.SENTRY_AUTH_TOKEN || ''}}" + ${{ matrix.image == 'frontend' && ((github.event_name == 'push' && github.repository == 'WordPress/openverse') || (github.event_name == 'workflow_dispatch' && inputs.perform_deploy)) && format('sentry_auth_token={0}', secrets.SENTRY_AUTH_TOKEN) || '' }} context: ${{ matrix.context }} target: ${{ matrix.target }} push: false diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 911cb4a1f52..bf25a6a88be 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -47,9 +47,15 @@ ENV NODE_ENV=production ENV NODE_OPTIONS="--max_old_space_size=4096" ENV SEMANTIC_VERSION=${SEMANTIC_VERSION} -# Use the Sentry auth token secret to send the sourcemaps to Sentry +# Use the Sentry auth token secret to send the sourcemaps to Sentry only if the secret is provided RUN --mount=type=secret,id=sentry_auth_token,mode=0444 \ - SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)" pnpm build + sh -c 'if [ -f /run/secrets/sentry_auth_token ]; then \ + SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)"; \ + echo "Using Sentry Auth Token: $SENTRY_AUTH_TOKEN"; \ + else \ + echo "No Sentry Auth Token provided"; \ + fi' && pnpm build + ############ # Nuxt app #