Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Created May 16, 2022 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebrandonfarrell/425bc399af715ac5a8a75fe18dfa9ad1 to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/425bc399af715ac5a8a75fe18dfa9ad1 to your computer and use it in GitHub Desktop.
Fastlane / Sentry Sourcemaps
lane :upload_sourcemaps do |options|
platform = options[:platform] || "ios"
version = options[:version] || get_version_number(xcodeproj: './ios/qeepsake.xcodeproj')
build_number = options[:build_number] || (platform == "ios" ? get_build_number(xcodeproj: "./ios/qeepsake.xcodeproj") : get_version_code())
bundle_name = platform == "ios" ? "main.jsbundle" : "index.android.bundle"
app_id = platform == "ios" ? "co.qeepsake.qeepsake" : "co.qeepsake.qeepsakeApp"
os_bin = platform == "ios" ? "osx-bin" : "linux64-bin"
puts "uploading sourcemaps for platform #{platform}, version #{version}, and build #{build_number}..."
sh("cd .. &&
npx react-native bundle --dev false --platform #{platform} --entry-file ./index.js --bundle-output ./#{platform}/#{bundle_name} --sourcemap-output ./#{platform}/#{bundle_name}.map &&
node_modules/hermes-engine/#{os_bin}/hermesc -O -emit-binary -output-source-map -out=./#{platform}/#{bundle_name}.hbc ./#{platform}/#{bundle_name} &&
node node_modules/react-native/scripts/compose-source-maps.js ./#{platform}/#{bundle_name}.map ./#{platform}/#{bundle_name}.hbc.map -o ./#{platform}/#{bundle_name}.map")
args = {
auth_token: '106c3eb00d8e4ed59f718c3796afd28b4521cd4d8872481b80e2fd88ba2e6074',
org_slug: 'qeepsake',
project_slug: 'qeepsake-mobile',
app_identifier: app_id,
rewrite: true,
dist: build_number,
version: version
}
sentry_upload_sourcemap(args.merge(sourcemap: "./#{platform}/#{bundle_name}", rewrite: false))
sentry_upload_sourcemap(args.merge(sourcemap: "./#{platform}/#{bundle_name}.map", rewrite: false))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment