diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 96a5f7b2..28652acb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -43,6 +43,7 @@ jobs: outputs: version: ${{ steps.configure.outputs.version }} build_no: ${{ steps.configure.outputs.build_no }} + build_piece: ${{ steps.configure.outputs.build_piece }} push_to_testflight: ${{ steps.configure.outputs.push_to_testflight }} push_to_playstore: ${{ steps.configure.outputs.push_to_playstore }} steps: @@ -111,11 +112,12 @@ jobs: BUILD_NO=$(( MAJOR*1000000 + MINOR*10000 + SUBV*100 + BUILD_PIECE )) echo "build_no=$BUILD_NO" >> $GITHUB_OUTPUT echo "version=$MAJOR.$MINOR.$SUBV" >> $GITHUB_OUTPUT + echo "build_piece=$BUILD_PIECE" >> $GITHUB_OUTPUT elif [[ "$VERSION" != "" ]]; then echo "INVALID VERSION FORMAT: $VERSION" exit 2 fi - + echo "push_to_playstore=$PUSH_PLAYSTORE" >> $GITHUB_OUTPUT echo "push_to_testflight=$PUSH_TESTFLIGHT" >> $GITHUB_OUTPUT echo "CONFIGURED:" @@ -144,7 +146,6 @@ jobs: dist: ${{ steps.configure.outputs.build_no }} version: ${{ steps.configure.outputs.version }} - build-android: name: ${{ needs.configure.outputs.push_to_playstore == 'false' && 'Build' || 'Build & Deploy' }} Android needs: configure @@ -153,6 +154,7 @@ jobs: LANG: en_US.UTF-8 CI: 'true' BUILD_NO: ${{ needs.configure.outputs.build_no }} + BUILD_PIECE: ${{ needs.configure.outputs.build_piece }} APP_VERSION: ${{ needs.configure.outputs.version }} SUPPLY_GOOGLE_JSON_PATH: './pc-api-secret.json' KEYSTORE_PW: ${{ secrets.ANDROID_KEYSTORE_PW }} @@ -160,6 +162,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Set .env + run: + echo "APP_VERSION=${{ needs.configure.outputs.version }}" >> .env + echo "APP_BUILD=${{ needs.configure.outputs.build_piece }}" >> .env - name: Gradle Wrapper Validation uses: gradle/wrapper-validation-action@v1 - name: Setup Ruby @@ -230,6 +236,7 @@ jobs: LANG: en_US.UTF-8 CI: 'true' BUILD_NO: ${{ needs.configure.outputs.build_no }} + BUILD_PIECE: ${{ needs.configure.outputs.build_piece }} APP_VERSION: ${{ needs.configure.outputs.version }} MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_KEY }} MATCH_GIT_PRIVATE_KEY: "./github_access.pk" @@ -245,6 +252,10 @@ jobs: xcode-version: '14' - name: Checkout uses: actions/checkout@v3 + - name: Set .env + run: + echo "APP_VERSION=${{ needs.configure.outputs.version }}" >> .env + echo "APP_BUILD=${{ needs.configure.outputs.build_piece }}" >> .env - name: Setup Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.sentryclirc b/.sentryclirc deleted file mode 100644 index bbeabafd..00000000 --- a/.sentryclirc +++ /dev/null @@ -1,7 +0,0 @@ -[defaults] -url = https://sentry.k8s.polito.it -project = students-app -org = polito - -[auth] -token=2522cbe3acb743d1835971ccb0cb46937de08504af00421ea7ce042c48e25beb diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 25b3b3f9..241c6cf8 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -60,7 +60,7 @@ platform :android do org_slug: ENV['SENTRY_ORG'], project_slug: ENV['SENTRY_PROJECT'], version: ENV['APP_VERSION'], - build: ENV['BUILD_NO'], + build: ENV['BUILD_PIECE'], sourcemap: [bundle_path, source_map_path], rewrite: true ) diff --git a/env.d.ts b/env.d.ts index 663227a0..56fb3ab6 100644 --- a/env.d.ts +++ b/env.d.ts @@ -1,3 +1,5 @@ declare module '@env' { export const API_BASE_PATH: string; + export const APP_VERSION: string; + export const APP_BUILD: string; } diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index c81873bd..4f208417 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -40,6 +40,21 @@ platform :ios do apple_id: "6443913305", ) + source_map_path = 'dist/main.jsbundle.map' + bundle_path = 'dist/main.jsbundle' + + sentry_upload_sourcemap( + auth_token: ENV['SENTRY_AUTH_TOKEN'], + org_slug: ENV['SENTRY_ORG'], + project_slug: ENV['SENTRY_PROJECT'], + version: ENV['APP_VERSION'], + build: ENV['BUILD_NO'], + sourcemap: [bundle_path, source_map_path], + rewrite: true + ) + + + end lane :verify do diff --git a/ios/sentry.properties b/ios/sentry.properties deleted file mode 100644 index c417cb2d..00000000 --- a/ios/sentry.properties +++ /dev/null @@ -1,4 +0,0 @@ -defaults.url=https://sentry.k8s.polito.it/ -defaults.org=polito -defaults.project=students-app -auth.token=2522cbe3acb743d1835971ccb0cb46937de08504af00421ea7ce042c48e25beb diff --git a/src/utils/sentry.ts b/src/utils/sentry.ts index 426daeb7..a74e608f 100644 --- a/src/utils/sentry.ts +++ b/src/utils/sentry.ts @@ -1,5 +1,4 @@ -import DeviceInfo from 'react-native-device-info'; - +import { APP_BUILD, APP_VERSION } from '@env'; import * as Sentry from '@sentry/react-native'; export const routingInstrumentation = @@ -14,8 +13,8 @@ export const initSentry = () => { routingInstrumentation, }), ], - dist: DeviceInfo.getBuildNumber(), - release: DeviceInfo.getVersion(), + release: `it.polito.students@${APP_VERSION}`, + dist: APP_BUILD, environment: process.env.NODE_ENV, tracesSampleRate: 1.0, });