Building and releasing
Language / 语言: 中文 · English
Use the same toolchain locally as in CI. Version and release configuration live in pubspec.yaml, .release-please-manifest.json, .release-policy.yml, and .github/workflows/release.yml.
Development environment
Install Flutter 3.47.1 and the build tools for your target. Android needs the Android SDK; build macOS on macOS and Windows on Windows.
flutter doctor
flutter pub get
flutter devices
flutter run -d <device-id>Desktop device IDs are macos and windows. For Android, use an ID from flutter devices. The app includes a public OAuth client ID. To use your own app, add --dart-define=DAKIT_CLIENT_ID=YOUR_PUBLIC_CLIENT_ID and register dakit://oauth/callback.
Pinned toolchain
| Component | Pinned version | Configuration |
|---|---|---|
| Flutter | 3.47.1 | .github/workflows/ci.yml, .release-policy.yml |
| Android Gradle Plugin | 8.13.2 | android/settings.gradle.kts |
| Gradle | 8.14.2 | android/gradle/wrapper/gradle-wrapper.properties |
| Kotlin | 2.2.20 | android/settings.gradle.kts |
| flutter_inappwebview | 6.1.5 (exact) | pubspec.yaml |
When upgrading Flutter or the WebView plugin, verify compilation of both the Android and macOS sub-packages.
Validation and builds
For Dart changes, run the same quality checks as CI before committing:
dart format --output=none --set-exit-if-changed lib test
flutter analyze
flutter testRun release builds on the corresponding platform:
flutter build apk --release --dart-define=DAVIEWER_VERSION=0.5.10 # Requires android/key.properties
flutter build macos --release --dart-define=DAVIEWER_VERSION=0.5.10
flutter build windows --release --dart-define=DAVIEWER_VERSION=0.5.10Replace the sample 0.5.10 with the version from pubspec.yaml, excluding the build number after +. Native package metadata does not set this Dart define; automatic update checks need it. CI passes the release version in scripts/build-release.
Android release builds require the upload keystore and android/key.properties; missing configuration fails the build. CI uses KEYSTORE_B64 and KEYSTORE_PROPERTIES. A PR dry-run without signing secrets can build a debug APK, but that APK cannot serve as a production release.
The current macOS script runs a Flutter release build and archives DAViewer.app. It has no stable preview-certificate import, Developer ID signing, or notarization step. The artifact keeps the macos-unsigned-preview name. Local ad-hoc signing or a missing TeamIdentifier is an environment limit. Verify Keychain access after upgrades on a real device; signing identity continuity is not guaranteed.
Release workflow
.github/workflows/release.yml calls ReleaseGraph. .release-policy.yml selects release-please versioning, three-platform builds, asset validation, and retention. PRs run in dry-run mode; pushes to main, scheduled runs, and manual dispatch enter the release workflow. The current workflow has no v* tag-push trigger.
- Manage version changes through release-please and check
pubspec.yamlagainst.release-please-manifest.json. - Write Chinese notes in
.github/release-notes/<version>.md, including a 本次更新 section. CI checks that the current manifest version has a notes file containing Chinese. Keep notes end-user facing: one sentence per change, about four bullets total, no root-cause analysis, log timestamps, or internal component names (style rules in.github/release-notes/README.md). - Pass quality, build, and asset checks. Manual acceptance requirements are in the Release gate (Chinese).
- After publishing, the script updates both download pages and dispatches Pages deployment.
CHANGELOG.mdandRELEASE_NOTES.mdretain past changes.
For a manual run, open Actions → Release → Run workflow:
| Input | Purpose |
|---|---|
version | Existing version; leave blank to read the manifest |
dry_run | Build and validate without publishing |
force | Rerun a healthy version |
repair | Repair the current incomplete version |
stage | Recovery stage label; defaults to all |
Asset names are DAViewer-v<version>.apk, DAViewer-v<version>-windows.zip, and DAViewer-v<version>-macos-unsigned-preview.zip. Retention keeps one stable release, one prerelease, and two failed drafts. Release-page retention does not describe source-history retention.
Build proxies
Configure build-tool proxies separately from the app proxy. Ports 7890 and 7892 below are examples; replace them with the HTTP/Mixed port shown by your proxy app.
Bash / zsh:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export no_proxy=localhost,127.0.0.1
flutter pub getPowerShell:
$env:http_proxy = 'http://127.0.0.1:7890'
$env:https_proxy = 'http://127.0.0.1:7890'
$env:no_proxy = 'localhost,127.0.0.1'
flutter pub getGradle runs on the JVM. Set JVM proxy properties explicitly when Android toolchain downloads need a proxy:
export GRADLE_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=7892 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=7892"
flutter build apk --debug$env:GRADLE_OPTS = '-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=7892 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=7892'
flutter build apk --debug