diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1320bb61..1f8469df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,8 @@ env: jobs: test: + outputs: + draftBuildCode: ${{ steps.draftBuildCode.outputs.datetime }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -44,6 +46,11 @@ jobs: - name: Test run: flutter test + - name: make draftBuildCode + id: draftBuildCode + run: echo "::set-output name=datetime::$(date +'%m-%dT%H-%M')" + + build: needs: test permissions: write-all @@ -78,6 +85,11 @@ jobs: steps: - name: checkout uses: actions/checkout@v3 + - name: update draft version + if: ${{ inputs.upload-artifact && inputs.tag-name == 'draft' }} + run: | + draftBuildCode="${{ needs.test.outputs.draftBuildCode }}" + sed -i "0,/version: [0-9.]*+/{s/version: [0-9.]*+/version: $draftBuildCode/}" pubspec.yml - name: Setup Flutter uses: subosito/flutter-action@v2 with: @@ -175,7 +187,7 @@ jobs: SENTRY_DIST: ${{ matrix.platform == 'android-aab' && 'google-play' || 'general' }} run: | flutter packages pub run sentry_dart_plugin - + - name: Copy to out Windows if: matrix.platform == 'windows' run: | diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index ff0f7a63..b57726fc 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -132,18 +132,9 @@ Future lazyBootstrap( "profile repository", () => container.read(profileRepositoryProvider.future), ); - Logger.bootstrap.info("Starting Singbox Service Provider"); - await _init( - "sing-box", - () => container.read(singboxServiceProvider).init(), - ); + Logger.bootstrap.info("Starting Active Profile"); - // await _safeInit( - // "active profile", - // () => container.read(activeProfileProvider.future), - // timeout: 1000, - // ); - await _init( + await _safeInit( "active profile", () => container.read(activeProfileProvider.future), timeout: 1000, @@ -154,7 +145,11 @@ Future lazyBootstrap( () => container.read(deepLinkNotifierProvider.future), timeout: 1000, ); - + Logger.bootstrap.info("Starting Singbox Service Provider"); + await _init( + "sing-box", + () => container.read(singboxServiceProvider).init(), + ); if (PlatformUtils.isDesktop) { Logger.bootstrap.info("Starting System Tray"); await _safeInit( @@ -202,7 +197,7 @@ Future _init( try { final result = await func(); Logger.bootstrap.debug( - "[$name] initialized in ${stopWatch.elapsedMilliseconds}ms ${result}"); + "[$name] initialized in ${stopWatch.elapsedMilliseconds}ms $result"); return result; } catch (e, stackTrace) { Logger.bootstrap.error("[$name] error initializing", e, stackTrace); @@ -219,7 +214,7 @@ Future _safeInit( }) async { try { return await _init(name, initializer, timeout: timeout); - } catch (_) { + } catch (e) { return null; } }