Skip to content

Commit

Permalink
feat: Added settings for Github Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Jan 5, 2023
1 parent 115a078 commit 27a60d9
Show file tree
Hide file tree
Showing 18 changed files with 1,139 additions and 34 deletions.
1 change: 1 addition & 0 deletions packages/katana_cli/bin/katana.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const commands = <String, CliCommand>{
"app": AppCliCommand(),
"pub": PubCliCommand(),
"code": CodeCliCommand(),
"github": GithubCliCommand(),
"create": CreateCliCommand(),
"submodule": SubmoduleCliCommand(),
};
Expand Down
75 changes: 75 additions & 0 deletions packages/katana_cli/lib/code/analysis_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
part of katana_cli;

/// Contents of katana.yaml.
///
/// analysis_options.yamlの中身。
class AnalysisOptionsCliCode extends CliCode {
/// Contents of katana.yaml.
///
/// analysis_options.yamlの中身。
const AnalysisOptionsCliCode();

@override
String get name => "analysis_options";

@override
String get prefix => "analysis_options";

@override
String get directory => "";

@override
String get description =>
"Define `analysis_options.yaml` with additional settings. `analysis_options.yaml`を追加設定込で定義します。";

@override
String import(String path, String baseName, String className) {
return "";
}

@override
String header(String path, String baseName, String className) {
return "";
}

@override
String body(String path, String baseName, String className) {
return r"""
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Set to exclude json_serializable files.
# json_serializableのファイルを除外するための設定。
analyzer:
exclude:
- "**/*.g.dart"
""";
}
}
58 changes: 58 additions & 0 deletions packages/katana_cli/lib/code/export_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
part of katana_cli;

/// Contents of ExportOptions.plist.
///
/// ExportOptions.plistの中身。
class ExportOptionsCliCode extends CliCode {
/// Contents of ExportOptions.plist.
///
/// ExportOptions.plistの中身。
const ExportOptionsCliCode();

@override
String get name => "ExportOptions";

@override
String get prefix => "ExportOptions";

@override
String get directory => "ios";

@override
String get description =>
"Create ExportOptions.plist for IOS builds. IOSビルド用のExportOptions.plistを作成します。";

@override
String import(String path, String baseName, String className) {
return "";
}

@override
String header(String path, String baseName, String className) {
return "";
}

@override
String body(String path, String baseName, String className) {
return r"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>generateAppStoreInformation</key>
<false/>
<key>method</key>
<string>app-store</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>uploadBitcode</key>
<false/>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
""";
}
}
140 changes: 140 additions & 0 deletions packages/katana_cli/lib/code/github_actions/android.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
part of katana_cli;

/// Contents of buiod.yaml for Android in Github Actions.
///
/// Github ActionsのAndroid用のbuiod.yamlの中身。
class GithubActionsAndroidCliCode extends CliCode {
/// Contents of buiod.yaml for Android in Github Actions.
///
/// Github ActionsのAndroid用のbuiod.yamlの中身。
const GithubActionsAndroidCliCode();

@override
String get name => "build_android";

@override
String get prefix => "build_android";

@override
String get directory => ".github/workflows";

@override
String get description =>
"Create buiod.yaml for Android in Github Actions. Please set up your keystore in advance with the katana app keystore. Github ActionsのAndroid用のbuiod.yamlを作成します。事前にkatana app keystoreでキーストアの設定を行ってください。";

@override
String import(String path, String baseName, String className) {
return "";
}

@override
String header(String path, String baseName, String className) {
return "";
}

@override
String body(String path, String baseName, String className) {
return r"""
name: Production Workflow
on:
# This workflow runs when there is a push on the publish branch.
# publish branch に push があったらこの workflow が走る。
push:
branches: [ publish ]
jobs:
# ----------------------------------------------------------------- #
# Build for Android
# ----------------------------------------------------------------- #
build_android:
runs-on: ubuntu-latest
steps:
# Check-out.
# チェックアウト。
- name: Checks-out my repository
uses: actions/checkout@v2
# Install flutter.
# Flutterのインストール。
- name: Install flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
# Check flutter version.
# Flutterのバージョン確認。
- name: Run flutter version
run: flutter --version
# Download package.
# パッケージのダウンロード。
- name: Download flutter packages
run: flutter pub get
# Running flutter analyze.
# Flutter analyzeの実行。
- name: Analyzing flutter project
run: flutter analyze
# Running the flutter test.
# Flutter testの実行。
- name: Testing flutter project
run: flutter test
# Generate appkey.keystore from Secrets.
# Secretsからappkey.keystoreを生成。
- name: Create appkey.keystore
run: echo -n ${{ secrets.ANDROID_KEYSTORE }} | base64 -d > android/app/appkey.keystore
# Generate service_account_key.json from Secrets.
# Secretsからservice_account_key.jsonを生成。
- name: Create service_account_key.json
run: echo -n ${{ secrets.ANDROID_SERVICE_ACCOUNT_KEY_JSON }} | base64 -d > android/service_account_key.json
# Generate key.properties from Secrets.
# Secretsからkey.propertiesを生成。
- name: Create key.properties
run: echo ${{ secrets.ANDROID_KEY_PROPERTIES }} | base64 -d > android/key.properties
# Generate Apk.
# Apkを生成。
- name: Building Android apk
run: flutter build apk --build-number ${GITHUB_RUN_NUMBER} --release --dart-define=FLAVOR=prod
# Generate app bundle.
# App Bundleを生成。
- name: Building Android AppBundle
run: flutter build appbundle --build-number ${GITHUB_RUN_NUMBER} --release --dart-define=FLAVOR=prod
# Upload the generated files.
# 生成されたファイルのアップロード。
- name: Upload apk artifacts
uses: actions/upload-artifact@v2.2.0
with:
name: andoroid_apk_release
path: ./build/app/outputs/apk/release
retention-days: 1
# Upload the generated files.
# 生成されたファイルのアップロード。
- name: Upload aab artifacts
uses: actions/upload-artifact@v2.2.0
with:
name: andoroid_aab_release
path: ./build/app/outputs/bundle/release
retention-days: 1
# Uploaded by `gradle-play-publisher`.
# https://github.com/Triple-T/gradle-play-publisher Use this external package.
# `gradle-play-publisher`でアップロード。
# https://github.com/Triple-T/gradle-play-publisher この外部パッケージを利用。
- name: Upload to GooglePlayStore
run: ./gradlew publishReleaseBundle
working-directory: ./android
""";
}
}

0 comments on commit 27a60d9

Please sign in to comment.