-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ add deploy.ts for source maps
- Loading branch information
Showing
6 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { default as envUtils } from "@next/env"; | ||
import { execSync } from "child_process"; | ||
|
||
envUtils.loadEnvConfig("."); | ||
|
||
async function setReleaseTag() { | ||
// Must use dynamic import for env variables to load properly | ||
const { getReleaseTag } = await import("./release-utils"); | ||
const release = getReleaseTag(); | ||
|
||
console.log("Using release tag:", release); | ||
|
||
execSync(`SENTRY_RELEASE='${release}' pnpm run build`, { stdio: "inherit" }); | ||
} | ||
|
||
setReleaseTag(); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { execSync } from "child_process"; | ||
import packageJson from "../../../package.json"; | ||
|
||
const getCommitHash = () => { | ||
if (process.env.VERCEL) { | ||
return process.env.VERCEL_GIT_COMMIT_SHA; | ||
} | ||
if (process.env.GITHUB_SHA) { | ||
return process.env.GITHUB_SHA; | ||
} | ||
try { | ||
const result = execSync("git rev-parse HEAD"); | ||
|
||
return result.toString().trim(); | ||
} catch (e) { | ||
console.warn("Cannot fetch commit hash", e); | ||
return null; | ||
} | ||
}; | ||
|
||
export const getReleaseTag = () => { | ||
const version = packageJson.version; | ||
|
||
if ( | ||
process.env.NODE_ENV === "production" && | ||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === "production" | ||
) { | ||
return version; | ||
} | ||
|
||
return `${version}-${getCommitHash() ?? "<unknown_commit_hash>"}`; | ||
}; |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.