Skip to content

Commit

Permalink
Remove secrets from git
Browse files Browse the repository at this point in the history
- remove key.properties file and add it to gitignore
- Change the keystore secrets
- Update release-apk workflow
- Update version
  • Loading branch information
dipu-bd committed Jun 10, 2021
1 parent 3236284 commit fb7a269
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 31 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/release-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: '12.x'

- uses: subosito/flutter-action@v1
with:
flutter-version: '2.x'
channel: 'stable'

- run: flutter pub get

- run: flutter build apk

env:
keyAlias: ${{ secrets.KEY_ALIAS }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
storeFile: ${{ secrets.STORE_FILE }}
storePassword: ${{ secrets.STORE_PASSWORD }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -36,15 +41,16 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/app/outputs/apk/release/app-release.apk
asset_name: SalesTracker.apk
asset_content_type: application/apk

2 changes: 1 addition & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

/key.properties
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} else {
keystoreProperties.setProperty('keyAlias', System.getenv('keyAlias'))
keystoreProperties.setProperty('keyPassword', System.getenv('keyPassword'))
keystoreProperties.setProperty('storeFile', System.getenv('storeFile'))
keystoreProperties.setProperty('storePassword', System.getenv('storePassword'))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
Expand Down
Binary file modified android/app/release.keystore
Binary file not shown.
4 changes: 0 additions & 4 deletions android/key.properties

This file was deleted.

34 changes: 17 additions & 17 deletions keygen.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
ALIAS=sales_tracker
STORE_PASS=s3cCC3XXree6
KEY_PASS=s3cc3rree6
KEYSTORE=android/app/release.keystore
#!/usr/bin/env bash

#rm -rf ${KEYSTORE}
cd android/app || exit 1
source ../key.properties

#rm -rf ${storeFile}
#keytool -v \
# -genkey \
# -storetype JKS \
# -keyalg RSA \
# -keysize 2048 \
# -validity 36500 \
# -alias ${ALIAS} \
# -storepass ${STORE_PASS} \
# -keypass ${KEY_PASS} \
# -keystore ${KEYSTORE} \
# -alias ${keyAlias} \
# -storepass ${storePassword} \
# -keypass ${keyPassword} \
# -keystore ${storeFile} \
# -dname "CN=Admin, OU=SalesTracker, O=Bitanon, L=Dhaka, S=Dhaka, C=BD"

#keytool -export -rfc \
# -file upload_certificate.pem \
# -alias ${ALIAS} \
# -storepass ${STORE_PASS} \
# -keypass ${KEY_PASS} \
# -keystore ${KEYSTORE}
# -alias ${keyAlias} \
# -storepass ${storePassword} \
# -keypass ${keyPassword} \
# -keystore ${storeFile}

keytool -list -v \
-alias ${ALIAS} \
-storepass ${STORE_PASS} \
-keypass ${KEY_PASS} \
-keystore ${KEYSTORE}
-alias ${keyAlias} \
-storepass ${storePassword} \
-keypass ${keyPassword} \
-keystore ${storeFile}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: sales_tracker
description: A generic sales tracking application
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.2.2+5
version: 1.2.3+6

environment:
sdk: ">=2.13.0 <3.0.0"
Expand Down

0 comments on commit fb7a269

Please sign in to comment.