Skip to content

Commit

Permalink
Add android sign.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Jun 20, 2023
1 parent 628615d commit 5f73bc5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
14 changes: 14 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ jobs:
- job: Build_Android
pool:
vmImage: 'ubuntu-20.04'
variables:
- group: 'Android sign'

steps:
- script: |
Expand All @@ -168,9 +170,21 @@ jobs:
- script: |
sudo snap install flutter --classic
displayName: 'Install flutter'
- task: DownloadSecureFile@1
name: keystore
displayName: 'Download keystore'
inputs:
secureFile: 'keystore.jks'

- script: |
cd tunet-flutter
cat > android/key.properties << EOL
storePassword=$(store-password)
keyPassword=$(key-password)
keyAlias=$(key-alias)
storeFile=$(keystore.secureFilePath)
EOL
make apk
cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk $(Build.ArtifactStagingDirectory)/tunet.armeabi-v7a.apk
cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk $(Build.ArtifactStagingDirectory)/tunet.arm64-v8a.apk
Expand Down
4 changes: 2 additions & 2 deletions tunet-flutter/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
# **/*.keystore
# **/*.jks
18 changes: 15 additions & 3 deletions tunet-flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ if (localPropertiesFile.exists()) {
}
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
Expand Down Expand Up @@ -50,11 +56,17 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
namespace 'com.berrysoft.tunet_flutter'
Expand Down

0 comments on commit 5f73bc5

Please sign in to comment.