Skip to content

Commit

Permalink
Merge pull request #8 from XPEHO/feat/release
Browse files Browse the repository at this point in the history
feat(release): create release workflow
  • Loading branch information
PiotrFLEURY authored Jul 21, 2021
2 parents dde658f + 48e139a commit 6688e55
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
flutter format --set-exit-if-changed .
flutter analyze
flutter test
flutter build apk
flutter build apk --debug
- name: Run Flutter test
run: flutter test
build-web:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: RELEASE
on:
workflow_dispatch:
branches:
- main

jobs:
# This workflow contains a single job called "build"
release:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Configure signature
run: |
echo "${{secrets.KEY_PROPERTIES}}" > android/key.properties
echo "${{secrets.RELEASE_KEYSTORE}}" > upload-keystore.encoded
base64 -d -i upload-keystore.encoded > ./android/app/upload-keystore.jks
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.0.5'
- name: Build apk
run: |
flutter pub get
flutter format --set-exit-if-changed .
flutter analyze
flutter test
flutter build apk
- name: Retrieve Release Version
id: versionstep
run: |
VERSION=$(more pubspec.yaml | grep version: | cut -d ' ' -f2)
echo "::set-output name=VERSION::$VERSION"
- name: Upload the APK onto Github
uses: ncipollo/release-action@v1
with:
artifacts: 'build/app/outputs/flutter-apk/*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.versionstep.outputs.VERSION }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/android/key.properties
19 changes: 16 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

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

android {
compileSdkVersion 30

Expand All @@ -41,13 +47,20 @@ 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
}
}

}

flutter {
Expand Down

0 comments on commit 6688e55

Please sign in to comment.