mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 15:03:12 +00:00
August SPA trees have no @sentry/cli. Skipping that step lets a workflow_dispatch of the live staging SHA finish the S3 sync.
28 lines
865 B
Bash
Executable file
28 lines
865 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
: "${SENTRY_AUTH_TOKEN:?SENTRY_AUTH_TOKEN is required for source-map upload}"
|
|
|
|
SENTRY_ORG="${SENTRY_ORG:-seahaven}"
|
|
SENTRY_PROJECT="${SENTRY_PROJECT:-shoc-frontend}"
|
|
COMMIT_SHA="${VITE_APP_COMMIT_SHA:-${GITHUB_SHA:-}}"
|
|
|
|
if [[ ! "${COMMIT_SHA}" =~ ^[0-9a-fA-F]{40}$ ]]; then
|
|
echo "::error::Source-map upload requires a 40-character VITE_APP_COMMIT_SHA or GITHUB_SHA." >&2
|
|
exit 1
|
|
fi
|
|
COMMIT_SHA="$(printf '%s' "${COMMIT_SHA}" | tr '[:upper:]' '[:lower:]')"
|
|
RELEASE="shoc-frontend@${COMMIT_SHA}"
|
|
|
|
if ! npm exec --no -- sentry-cli --version >/dev/null 2>&1; then
|
|
echo "sentry-cli is not in this SPA tree; skipping source-map upload"
|
|
exit 0
|
|
fi
|
|
|
|
npm exec --no -- sentry-cli sourcemaps upload \
|
|
--org "${SENTRY_ORG}" \
|
|
--project "${SENTRY_PROJECT}" \
|
|
--release "${RELEASE}" \
|
|
--url-prefix "~/" \
|
|
--validate \
|
|
dist
|