diff --git a/.github/workflows/sentry.yml b/.github/workflows/sentry.yml new file mode 100644 index 000000000..53921fd5e --- /dev/null +++ b/.github/workflows/sentry.yml @@ -0,0 +1,50 @@ +# This is a basic workflow to help you get started with Actions + +name: Sentry + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [sentry-test] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install Yarn + run: npm install -g yarn + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: "**/node_modules" + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Install Dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --ignore-scripts + - name: Copy env + run: cp .env.example .env + - name: Build Production + run: yarn build + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + REACT_APP_SENTRY_ENVIRONMENT: production + CI: false diff --git a/config-overrides.js b/config-overrides.js index 4eb5bc45f..737159b5b 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -85,26 +85,26 @@ module.exports = { fs.copyFileSync(vendorFileSrc, vendorFileDest); } - // if (!isDevelopment && process.env.SENTRY_AUTH_TOKEN) { - // const SentryWebpackPlugin = require('@sentry/webpack-plugin'); - // config.devtool = 'source-map'; - // config.plugins.push( - // new SentryWebpackPlugin({ - // org: 'oraichain', - // project: 'oraidex', + if (!isDevelopment && process.env.SENTRY_AUTH_TOKEN) { + const SentryWebpackPlugin = require('@sentry/webpack-plugin'); + config.devtool = 'source-map'; + config.plugins.push( + new SentryWebpackPlugin({ + org: 'oraichain', + project: 'oraidex', - // // Specify the directory containing build artifacts - // include: './build', + // Specify the directory containing build artifacts + include: './build', - // // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/ - // // and needs the `project:releases` and `org:read` scopes - // authToken: process.env.SENTRY_AUTH_TOKEN, + // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/ + // and needs the `project:releases` and `org:read` scopes + authToken: process.env.SENTRY_AUTH_TOKEN, - // // Optionally uncomment the line below to override automatic release name detection - // release: vendorHash - // }) - // ); - // } + // Optionally uncomment the line below to override automatic release name detection + release: vendorHash + }) + ); + } config.plugins.push( new webpack.DllReferencePlugin({