Skip to content

Commit

Permalink
Add release to sentry init (#205)
Browse files Browse the repository at this point in the history
* Add release to sentry init

* Lower traces

* Update preview actions

* Add sentry auth token

* Do a sentry release

* Fix tag?

* Fix the branch name?

* motherfucker

* At master

* Fix the release

* Try different version

* fetch depth 0

* Ignore empty

* Add ignore missing

* Add env for sentry

* test sentry release

* Remove comma

* set release

* Edgio env

* Create release

* Fix env variables
  • Loading branch information
petrvecera authored May 31, 2023
1 parent fe2203b commit 1543fc8
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
EDGIO_ENV: prod
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN}}

jobs:
build-deploy-web:
Expand Down Expand Up @@ -37,6 +38,18 @@ jobs:
run: yarn --prefer-offline --frozen-lockfile install
- name: Disable Vercel telemetry
run: yarn next telemetry disable

- name: Create Sentry release
uses: getsentry/action-release@master
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: coh-stats
SENTRY_PROJECT: coh3-stats-web
with:
environment: ${{ env.EDGIO_ENV }}
ignore_empty: true
ignore_missing: true

- name: Deploy to Edgio hosting
env:
DEPLOY_TOKEN: ${{ secrets.EDGIO_DEPLOY_TOKEN}}
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
EDGIO_ENV: dev
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN}}

jobs:
build-deploy-web:
Expand Down Expand Up @@ -37,6 +38,18 @@ jobs:
run: yarn --prefer-offline --frozen-lockfile install
- name: Disable Vercel telemetry
run: yarn next telemetry disable

- name: Create Sentry release
uses: getsentry/action-release@master
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: coh-stats
SENTRY_PROJECT: coh3-stats-web
with:
environment: ${{ env.EDGIO_ENV }}
ignore_empty: true
ignore_missing: true

- name: Deploy to Edgio hosting
env:
DEPLOY_TOKEN: ${{ secrets.EDGIO_DEPLOY_TOKEN}}
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
env:
EDGIO_ENV: preview
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN}}

jobs:
build-deploy-web:
Expand All @@ -22,7 +23,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@master
with:
Expand All @@ -43,8 +46,21 @@ jobs:
run: yarn --prefer-offline --frozen-lockfile install
- name: Disable Vercel telemetry
run: yarn next telemetry disable

- name: Create Sentry release
uses: getsentry/action-release@master
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: coh-stats
SENTRY_PROJECT: coh3-stats-web
with:
environment: ${{ env.EDGIO_ENV }}
ignore_empty: true
ignore_missing: true

- name: Run the build
run: yarn build

- name: Deploy to Edgio hosting
env:
DEPLOY_TOKEN: ${{ secrets.EDGIO_DEPLOY_TOKEN_PREVIEW}}
Expand All @@ -53,7 +69,7 @@ jobs:
- uses: jwalton/gh-find-current-pr@v1
id: finder
- name: Publish Preview Link
uses: marocchino/sticky-pull-request-comment@v2.2.0
uses: marocchino/sticky-pull-request-comment@v2.6.2
with:
number: ${{ steps.finder.outputs.pr }}
header: preview
Expand Down
16 changes: 15 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,18 @@ const withEdgioConfig = withEdgio(
}),
);

module.exports = withSentryConfig(withEdgioConfig, { silent: true }, { hideSourcemaps: true });
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs

// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

module.exports = withSentryConfig(withEdgioConfig, sentryWebpackPluginOptions, {
hideSourcemaps: true,
});
15 changes: 12 additions & 3 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ Sentry.init({
SENTRY_DSN ||
"https://963a73a12146449490c37b42cfc1419f@o4504995920543744.ingest.sentry.io/4504995924344832",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.1,
environment: process.env.NODE_ENV,
tracesSampleRate: 0.05,
// release: "vTestRelease",
// release: process.env.BRANCH_NAME || process.env.GITHUB_REF_NAME,
environment:
process.env.EDGIO_ENV || process.env.EDGIO_ENVIRONMENT_NAME || process.env.NODE_ENV,
allowUrls: [/https?:\/\/((dev)\.)?coh3stats\.com/],
ignoreErrors: ["TypeError: Failed to fetch"],
ignoreErrors: [
"TypeError: Failed to fetch",
"The operation was aborted",
"QuotaExceededError",
"AbortError: AbortError",
"NetworkError when attempting to fetch resource.",
],
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
Expand Down
7 changes: 5 additions & 2 deletions sentry.edge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ Sentry.init({
SENTRY_DSN ||
"https://963a73a12146449490c37b42cfc1419f@o4504995920543744.ingest.sentry.io/4504995924344832",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.1,
environment: process.env.NODE_ENV,
tracesSampleRate: 0.05,
release: "vTestRelease",
// release: process.env.BRANCH_NAME || process.env.GITHUB_REF_NAME,
environment:
process.env.EDGIO_ENV || process.env.EDGIO_ENVIRONMENT_NAME || process.env.NODE_ENV,
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
Expand Down
7 changes: 5 additions & 2 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ Sentry.init({
SENTRY_DSN ||
"https://963a73a12146449490c37b42cfc1419f@o4504995920543744.ingest.sentry.io/4504995924344832",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.1,
environment: process.env.NODE_ENV,
tracesSampleRate: 0.01,
// release: "vTestRelease",
// release: process.env.BRANCH_NAME || process.env.GITHUB_REF_NAME,
environment:
process.env.EDGIO_ENV || process.env.EDGIO_ENVIRONMENT_NAME || process.env.NODE_ENV,
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
Expand Down

0 comments on commit 1543fc8

Please sign in to comment.