Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: 优化 Sentry 相关配置的设置方法 #398

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,8 @@ jobs:
- name: Set version name
run: |
sed -ri "s#^version: .+#version: $VERSION#g" pubspec.yaml
sed -ri "s#..dsn = ''#..dsn = '$SENTRY_DSN'#g" ./lib/bootstrap.dart
sed -ri "s#..release = 'release'#..release = '$RELEASE'#g" ./lib/bootstrap.dart
env:
VERSION: ${{ needs.test.outputs.version }}
ENVIRONMENT: ${{ needs.test.outputs.environment }}
RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Decrypt large secret
run: ./.github/scripts/decrypt_secret.sh
env:
Expand All @@ -90,6 +85,8 @@ jobs:
run: flutter build apk --target-platform android-arm64,android-x64 --split-per-abi -t ./lib/main_$ENVIRONMENT.dart --flavor $ENVIRONMENT
env:
ENVIRONMENT: ${{ needs.test.outputs.environment }}
SENTRY_RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Upload split-per-abi apks
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
Expand All @@ -107,13 +104,8 @@ jobs:
- name: Set version name
run: |
sed -ri "s#^version: .+#version: $VERSION#g" pubspec.yaml
sed -ri "s#..dsn = ''#..dsn = '$SENTRY_DSN'#g" ./lib/bootstrap.dart
sed -ri "s#..release = 'release'#..release = '$RELEASE'#g" ./lib/bootstrap.dart
env:
VERSION: ${{ needs.test.outputs.version }}
ENVIRONMENT: ${{ needs.test.outputs.environment }}
RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Setup Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
Expand All @@ -125,6 +117,8 @@ jobs:
flutter build web --web-renderer=html --source-maps -t ./lib/main_$ENVIRONMENT.dart
env:
ENVIRONMENT: ${{ needs.test.outputs.environment }}
SENTRY_RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Upload web version
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
Expand All @@ -149,13 +143,8 @@ jobs:
- name: Set version name
run: |
sed -ri "s#^version: .+#version: $VERSION#g" pubspec.yaml
sed -ri "s#..dsn = ''#..dsn = '$SENTRY_DSN'#g" .\lib\bootstrap.dart
sed -ri "s#..release = 'release'#..release = '$RELEASE'#g" .\lib\bootstrap.dart
env:
VERSION: ${{ needs.test.outputs.version }}
ENVIRONMENT: ${{ needs.test.outputs.environment }}
RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Setup Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
Expand All @@ -167,6 +156,8 @@ jobs:
flutter build windows -t ./lib/main_${env:ENVIRONMENT}.dart
env:
ENVIRONMENT: ${{ needs.test.outputs.environment }}
SENTRY_RELEASE: ${{ needs.test.outputs.release }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Upload windows version
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

- 物品管理位置二维码支持完整的网址

### Changed

- 优化 Sentry 相关配置的设置方法

### Fixed

- 修复搜索位置无法显示的问题
Expand Down
6 changes: 3 additions & 3 deletions lib/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Future<void> bootstrap(AppConfig appConfig) async {
await SentryFlutter.init(
(options) {
options
..dsn = ''
..environment = 'dev'
..release = 'release';
..dsn = const String.fromEnvironment('SENTRY_DSN', defaultValue: '')
..environment = appConfig.flavorName
..release = const String.fromEnvironment('SENTRY_RELEASE');
},
appRunner: () => runApp(
MyApp(
Expand Down
Loading