add release version to sentry ci process

This commit is contained in:
Amruth Pillai
2022-12-02 23:16:48 +01:00
parent e36fbb5f64
commit ea2aee2d25
9 changed files with 917 additions and 7 deletions

View File

@ -2,6 +2,12 @@
TURBO_TEAM=
TURBO_TOKEN=
# Sentry Error Logging (Optional)
SENTRY_ORG=reactive-resume
SENTRY_AUTH_TOKEN=
SERVER_SENTRY_DSN=
PUBLIC_CLIENT_SENTRY_DSN=
# Server + Client
TZ=UTC
PUBLIC_URL=http://localhost:3000

View File

@ -48,6 +48,16 @@ jobs:
username: $GITHUB_REPOSITORY_OWNER
password: ${{ secrets.GH_TOKEN }}
- name: Create Sentry Release
uses: getsentry/action-release@v1.2.1
env:
SENTRY_ORG: reactive-resume
SENTRY_PROJECT: ${{ matrix.image }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: production
version: ${{ steps.version.outputs.current-version }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v3.2.0
with:

View File

@ -1,14 +1,15 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
import packageJSON from '../package.json';
console.log(SENTRY_DSN);
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
release: packageJSON.version,
enabled: process.env.NODE_ENV === 'production',
});
}

View File

@ -1,12 +1,15 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
import packageJSON from '../package.json';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
release: packageJSON.version,
enabled: process.env.NODE_ENV === 'production',
});
}

View File

@ -3,10 +3,10 @@
"version": "3.6.14",
"private": true,
"scripts": {
"dev": "env-cmd --silent turbo run dev",
"dev": "env-cmd --silent cross-var cross-env VERSION=$npm_package_version turbo run dev",
"lint": "turbo run lint",
"build": "env-cmd --silent turbo run build",
"start": "env-cmd --silent turbo run start",
"build": "env-cmd --silent cross-var cross-env VERSION=$npm_package_version turbo run build",
"start": "env-cmd --silent cross-var cross-env VERSION=$npm_package_version turbo run start",
"format": "prettier --write ."
},
"workspaces": [
@ -15,6 +15,8 @@
"server"
],
"dependencies": {
"cross-env": "^7.0.3",
"cross-var": "^1.1.0",
"env-cmd": "^10.1.0",
"turbo": "^1.6.3"
},

887
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ import { registerAs } from '@nestjs/config';
export default registerAs('app', () => ({
timezone: process.env.TZ,
version: process.env.VERSION,
environment: process.env.NODE_ENV,
secretKey: process.env.SECRET_KEY,
port: parseInt(process.env.PORT, 10) || 3100,

View File

@ -15,6 +15,7 @@ const validationSchema = Joi.object({
// App
TZ: Joi.string().default('UTC'),
PORT: Joi.number().default(3100),
VERSION: Joi.string().required(),
SECRET_KEY: Joi.string().required(),
NODE_ENV: Joi.string().valid('development', 'production').default('development'),

View File

@ -23,9 +23,12 @@ const bootstrap = async () => {
// Sentry Error Logging
const sentryDSN = configService.get<string>('logging.sentryDSN');
const version = configService.get<string>('app.version');
if (sentryDSN) {
Sentry.init({
dsn: sentryDSN,
release: version,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === 'production',
});