Skip to content

Instantly share code, notes, and snippets.

jobs:
release-android:
name: release android app
runs-on: ubuntu-latest
steps:
- ...
- name: promote to production
if: contains(github.event_name,'release')&&(!github.event.release.prerelease)
run: bundle exec fastlane production
- ...
@tianhaoz95
tianhaoz95 / build.gradle
Last active April 1, 2020 06:55
example code signing script
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
// other config
signingConfigs {
release {
// def keystoreProperties = new Properties()
// def keystorePropertiesFile = rootProject.file('key.properties')
// if (keystorePropertiesFile.exists()) {
// keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
// }
android {
// other config
signingConfigs {
release {
@tianhaoz95
tianhaoz95 / build.gradle
Created April 1, 2020 07:34
Bypass code signing credential if in debug mode
signingConfigs {
release {
keyAlias System.getenv('ANDROID_DEBUG') ? null : keystoreProperties['keyAlias']
keyPassword System.getenv('ANDROID_DEBUG') ? null : keystoreProperties['keyPassword']
storeFile System.getenv('ANDROID_DEBUG') ? null : file(keystoreProperties['storeFile'])
storePassword System.getenv('ANDROID_DEBUG') ? null : keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig System.getenv('ANDROID_DEBUG') ? signingConfigs.debug : signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@tianhaoz95
tianhaoz95 / Gemfile
Created April 4, 2020 04:07
sample Pluginfile to use flutter_version
source "https://rubygems.pkg.github.com/tianhaoz95" do
gem "fastlane-plugin-flutter_version", "0.1.7"
end
@tianhaoz95
tianhaoz95 / Fastfile.ruby
Created April 4, 2020 04:12
sample Fastfile to user flutter_version
platform :android do
desc "Submit app to Google Play Store"
lane :internal do
begin
gradle(task: 'bundle', build_type: 'Release')
upload_to_play_store(
track: 'internal',
# This line uses flutter_version plugin to retrieve the version code
version_code: flutter_version()["version_code"]
)
@tianhaoz95
tianhaoz95 / install_fastlane_plugin.yml
Created April 4, 2020 04:16
sample GitHub action script to fetch packages from GitHub registry
- name: install fastlane plugins
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
run: |
bundle config rubygems.pkg.github.com tianhaoz95:$GITHUB_TOKEN
bundle install
bundle exec fastlane install_plugins
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(debugShowCheckedModeBanner: false, home: HomeScreen());
}
}
@tianhaoz95
tianhaoz95 / app.dart
Created May 25, 2020 01:24
Most simple app theme (hard coded).
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My App',
theme: ThemeData(),
darkTheme: ThemeData(brightness: Brightness.dark),
);
}
}