Add option to set dist on sourcemaps
I'm using the Sentry Release action to create a release of my React Native app and part of that is uploading sourcemaps. Here's how I'm doing it:
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
VERSION_CODE: ${{ steps.get_version.outputs.VERSION_CODE }}
VERSION_NAME: ${{ steps.get_version.outputs.VERSION_NAME }}
with:
environment: production
version: com.a494studios.koreanconjugator@${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}
url_prefix: app:///
sourcemaps: android/app/build/generated/assets/react/release/index.android.bundle android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
The problem is that the sourcemaps aren't working correctly because they're not being assigned a dist value. With the CLI I would use the --dist flag, but I don't see an option for that in the docs or in the source code. Is there any interest in adding a dist option to this action? I could probably make a PR to add that change in if it's desired.
@Ninjaman494 I would love to see this option too please. We are running 3 distributions and one is built using a Github Action Workflow. Unfortunately that is also the only one for which sourcemaps is not working because we don't have this option.
It is an easy add and the usage could look like:
- name: Create Sentry Release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: 'my-project-name'
with:
environment: 'prod'
sourcemaps: './sourcemaps'
version: '[email protected]+a123456'
dist: 'web'
@beonde I forked this repo and tried adding it, but it was harder than I thought. It's been awhile since I looked at it, but from what I remember I was having trouble actually testing my changes. The action is setup to pull a Docker container that contains a build, so simply forking and pushing up changes wasn't enough. You're welcome to take a look though: https://github.com/Ninjaman494/action-release.
I ended up using the Sentry CLI to upload the sourcemaps in my GHA workflow:
- name: Setup Sentry CLI
uses: mathieu-bour/[email protected]
with:
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
organization: ${{ secrets.SENTRY_ORG }}
project: ${{ secrets.SENTRY_PROJECT }}
- name: Create Sentry release
run: |
sentry-cli releases \
files com.example.app@${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }} \
upload-sourcemaps \
--dist ${{ env.VERSION_CODE }} \
android/app/build/generated/assets/react/release/index.android.bundle android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
@Ninjaman494 Thats a good work around. Thanks for the suggestion! I think I’ll implement that for a fix
@mgaeta Any chance of getting this fixed soon? Thanks!
If dist (in events) isn't a must-have, assigning dist = '' in Sentry.init seems strip it (as opposed to dist = undefined or dist = null).
Same requirement here. We are uploading sourcemaps to different projects within the same version identifier / release from a monorepo.