Skip to content

Commit

Permalink
chore(ci): github action for sentry releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Sep 9, 2022
1 parent 779cc1a commit 79b153e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/sentry-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Sentry release source maps
on:
push:
branches:
- main
- dev
paths:
- 'apps/core/src/**'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node 16
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install projects dependencies
uses: bahmutov/npm-install@v1

- name: Generate sourcemaps from build
run: yarn build:prod --filter=@sharingan/core

- name: Create a Sentry release
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sharingan
SENTRY_PROJECT: backend
VERSION: ${{ github.sha }}
run: |
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.2.0" bash
sentry-cli releases new "$VERSION"
sentry-cli releases files "$VERSION" upload-sourcemaps ./apps/core/build
sentry-cli releases finalize "$VERSION"
2 changes: 1 addition & 1 deletion apps/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "rm -rf .turbo dist build logs",
"dev": "nodemon --watch \"*.ts\" --exec \"ts-node\" ./src/index.ts",
"lint": "eslint src",
"build:prod": "esbuild ./src/index.ts --bundle --platform=node --outfile=build/index.js",
"build:prod": "esbuild ./src/index.ts --bundle --sourcemap --platform=node --outfile=build/index.js",
"test": "jest",
"gql:gen:types": "yarn graphql-codegen"
},
Expand Down
6 changes: 5 additions & 1 deletion apps/core/src/server/rest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express, { Application } from 'express';
import express, { Application, Request, Response } from 'express';

import { authenticationRoute } from '../resources/authentication/routes';
import { errorHandlerMiddleware } from './middleware/error-middleware';
Expand All @@ -16,6 +16,10 @@ export const setupRestEndpoints = (app: Application) => {
app.use('/', router);
app.use('/', authenticationRoute());

app.get('/', (_req: Request, res: Response) => {
res.json({ message: 'Hello from Sharingan!' });
});

app.use(notFoundMiddleware);

app.use(errorHandlerMiddleware);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "MIT",
"scripts": {
"build": "turbo run build",
"build:prod": "turbo run build:prod",
"build:backend": "turbo run build --filter=!@sharingan/web",
"dev": "turbo run dev --no-cache --parallel --continue",
"lint": "turbo run lint",
Expand Down
4 changes: 4 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"dependsOn": ["^build"],
"outputs": []
},
"build:prod": {
"dependsOn": ["^build"],
"outputs": ["build/**"]
},
"lint": {
"outputs": []
},
Expand Down

0 comments on commit 79b153e

Please sign in to comment.