Compare commits

...

2 Commits

Author SHA1 Message Date
7352d0bb43 Automatically update commit_sha variable on deploy
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 1m12s
Test, Build, Deploy / Create Sentry Release (push) Successful in 6s
2026-03-13 05:29:15 -04:00
291afd5eaa Set commit sha as release 2026-03-13 05:28:33 -04:00
4 changed files with 35 additions and 5 deletions

View File

@@ -5,6 +5,13 @@ jobs:
Test-Build-Deploy:
name: Test, Build, and Deploy
runs-on: ubuntu-latest
env:
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_PROJECT_NAME: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
COMMIT_SHA: ${{ gitea.sha }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
@@ -26,14 +33,28 @@ jobs:
- name: Build
run: npm run build
- name: Set Version as Var
run: |
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/$CLOUDFLARE_PROJECT_NAME \
-X PATCH \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"deployment_configs": {
"production": {
"env_vars": {
"COMMIT_SHA": {
"type": "plain_text",
"value": "'"$COMMIT_SHA"'"
}
}
}
}
}'
- name: Deploy
run: wrangler pages deploy public --project-name $CLOUDFLARE_PROJECT_NAME
env:
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_PROJECT_NAME: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
Sentry-Release:
name: Create Sentry Release
runs-on: ubuntu-latest

View File

@@ -20,6 +20,10 @@ Sentry.init({
],
replaysOnErrorSampleRate: 1,
replaysSessionSampleRate: 0.02,
release:
document
.querySelector("meta[name='commit_sha']")
?.getAttribute("content") ?? undefined,
sendDefaultPii: true,
tracesSampleRate: 0.1,
tunnel: "/api/st",

View File

@@ -130,6 +130,7 @@ export async function loader({
}): Promise<{ [k: string]: any }> {
let data: { [k: string]: string } = {};
if (context.env.COMMIT_SHA) data.commit_sha = context.env.COMMIT_SHA;
if (context.data.current_user) data = { ...context.data.current_user };
if (context.env.REMIX_DSN) data.dsn = context.env.REMIX_DSN;
if (context.data.nonce) data.nonce = context.data.nonce;
@@ -202,6 +203,9 @@ function DocumentWrapper(props: {
/>
))}
<meta charSet="UTF-8" />
{loaderData.commit_sha ? (
<meta name="commit_sha" content={loaderData.commit_sha} />
) : null}
{loaderData.dsn ? (
<meta name="dsn" content={loaderData.dsn} />
) : null}

View File

@@ -383,6 +383,7 @@ async function setTheme(context: RequestContext) {
export const onRequest = [
Sentry.sentryPagesPlugin((context: RequestContext) => ({
dsn: context.env.FUNCTIONS_DSN,
release: context.env.COMMIT_SHA,
sendDefaultPii: true,
})),
setAuth,