Upload source maps to Sentry #2
Workflow file for this run
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
name: Upload source maps to Sentry | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
types: [ opened, synchronize ] | |
env: | |
NEXT_PUBLIC_GIT_TAG: v1.13.2 | |
SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
jobs: | |
build_and_upload: | |
name: Build app with source maps and upload to Sentry | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
with: | |
path: | | |
node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile --ignore-optional | |
- name: Make production build with source maps | |
run: yarn build | |
env: | |
NODE_ENV: production | |
GENERATE_SOURCEMAPS: true | |
- name: Inject Sentry debug ID | |
run: yarn sentry-cli sourcemaps inject ./.next | |
- name: Upload source maps to Sentry | |
run: yarn sentry-cli sourcemaps upload --release=${{ env.NEXT_PUBLIC_GIT_TAG }} --validate ./.next |