Change android signing
This commit is contained in:
45
.github/workflows/build.yml
vendored
45
.github/workflows/build.yml
vendored
@@ -4,12 +4,12 @@ on:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
- 'v*'
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "docs/**"
|
||||
- ".github/**"
|
||||
- "!.github/workflows/build.yml"
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- '.github/**'
|
||||
- '!.github/workflows/build.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -64,15 +64,15 @@ jobs:
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: "3.13.x"
|
||||
channel: "stable"
|
||||
flutter-version: '3.13.x'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
- name: Setup Java
|
||||
if: startsWith(matrix.platform,'android')
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "zulu"
|
||||
distribution: 'zulu'
|
||||
java-version: 11
|
||||
|
||||
- name: Setup Flutter Distributor
|
||||
@@ -114,23 +114,12 @@ jobs:
|
||||
|
||||
- name: Setup Signing Properties
|
||||
if: startsWith(matrix.platform,'android')
|
||||
env:
|
||||
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
|
||||
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
|
||||
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
|
||||
ANDROID_SIGNING_KEY: ${{ secrets.ANDROID_SIGNING_KEY }}
|
||||
run: |
|
||||
cd android
|
||||
pwd
|
||||
touch signing.properties
|
||||
echo $ANDROID_SIGNING_KEY | base64 -d > release.keystore
|
||||
echo "keystore.path=release.keystore" > release.properties
|
||||
echo keystore.password="$ANDROID_SIGNING_STORE_PASSWORD" >> release.properties
|
||||
echo key.alias="$ANDROID_SIGNING_KEY_ALIAS" >> release.properties
|
||||
echo key.password="$ANDROID_SIGNING_KEY_PASSWORD" >> release.properties
|
||||
cp release.* app/
|
||||
cat release.properties
|
||||
cd ..
|
||||
echo "${{ secrets.ANDROID_SIGNING_KEY }}" | base64 --decode > android/key.jks
|
||||
echo "storeFile=$(pwd)/android/key.jks" > android/key.properties
|
||||
echo "storePassword=${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}" >> android/key.properties
|
||||
echo "keyPassword=${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}" >> android/key.properties
|
||||
echo "keyAlias=${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}" >> android/key.properties
|
||||
|
||||
- name: Release ${{ matrix.platform }}
|
||||
env:
|
||||
@@ -258,7 +247,7 @@ jobs:
|
||||
uses: 8Mi-Tech/delete-release-assets-action@main
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: "draft"
|
||||
tag: 'draft'
|
||||
deleteOnlyFromDrafts: false
|
||||
|
||||
- name: Create or Update Draft Release
|
||||
@@ -268,8 +257,8 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: ./out/*
|
||||
name: "draft"
|
||||
tag_name: "draft"
|
||||
name: 'draft'
|
||||
tag_name: 'draft'
|
||||
prerelease: true
|
||||
|
||||
upload-release:
|
||||
@@ -309,7 +298,7 @@ jobs:
|
||||
with:
|
||||
prerelease: ${{ env.CHANNEL == 'dev' }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
body_path: "./release.md"
|
||||
body_path: './release.md'
|
||||
files: ./out/*
|
||||
|
||||
- name: Create service_account.json
|
||||
|
||||
@@ -11,6 +11,24 @@ if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
boolean hasKeyStore = false
|
||||
|
||||
def keystoreProperties = new Properties()
|
||||
def keystorePropertiesFile = rootProject.file('key.properties')
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
hasKeyStore = true
|
||||
} else {
|
||||
println "+++"
|
||||
println "No keystore defined. The app will not be signed."
|
||||
println "Create a android/key.properties file with the following properties:"
|
||||
println "storePassword"
|
||||
println "keyPassword"
|
||||
println "keyAlias"
|
||||
println "storeFile"
|
||||
println "+++"
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
@@ -21,11 +39,6 @@ if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
def keystoreProperties = new Properties()
|
||||
def keystorePropertiesFile = rootProject.file('release.properties')
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
@@ -61,24 +74,33 @@ android {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
//noinspection ChromeOsAbiSupport
|
||||
include "x86_64", "armeabi-v7a", "arm64-v8a"
|
||||
|
||||
universalApk true
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias keystoreProperties['key.alias']
|
||||
keyPassword keystoreProperties['key.password']
|
||||
storeFile keystoreProperties['keystore.path'] ? file(keystoreProperties['keystore.path']) : null
|
||||
storePassword keystoreProperties['keystore.password']
|
||||
if (hasKeyStore) {
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias keystoreProperties['keyAlias']
|
||||
keyPassword keystoreProperties['keyPassword']
|
||||
storeFile file(keystoreProperties['storeFile'])
|
||||
storePassword keystoreProperties['storePassword']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
if (hasKeyStore) {
|
||||
signingConfig signingConfigs.release
|
||||
} else {
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
ndk {
|
||||
//noinspection ChromeOsAbiSupport
|
||||
abiFilters "x86_64", "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user