Skip to content

Commit

Permalink
fix: Add web to GithubActions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Jan 6, 2023
1 parent 3ff816c commit e20a50d
Show file tree
Hide file tree
Showing 10 changed files with 524 additions and 298 deletions.
45 changes: 34 additions & 11 deletions packages/katana_cli/lib/code/github_actions/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GithubActionsAndroidCliCode extends CliCode {

@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でキーストアの設定を行ってください。";
"Create buiod.yaml for Android in Github Actions. Please set up your keystore in the katana app keystore beforehand. Also, create the app in Google Play Console, upload the aab file for the first time, and complete the app settings except for the store listing information settings. Github ActionsのAndroid用のbuiod.yamlを作成します。事前にkatana app keystoreでキーストアの設定を行ってください。また、GooglePlayConsoleでアプリを作成し、aabファイルの初回アップロード、アプリの設定でストア掲載情報設定以外を済ませておいてください。";

@override
String import(String path, String baseName, String className) {
Expand All @@ -35,7 +35,26 @@ class GithubActionsAndroidCliCode extends CliCode {
@override
String body(String path, String baseName, String className) {
return r"""
name: Android Production Workflow
# Build and upload your Flutter Android app.
#
# apk and aab files will be stored in Github storage. (Storage period is 1 day)
#
# The app is uploaded to GooglePlayConsole in an internal test draft.
#
# Please create a keystore for your app in advance with `katana app keystore`.
#
# Also, please create your app in Google PlayConsole, upload the aab file for the first time, and complete the app settings except for the store listing information settings.
#
# FlutterのAndroidアプリをビルドしアップロードします。
#
# apkファイルとaabファイルがGithubのストレージに保管されます。(保管期限1日)
#
# GooglePlayConsoleへアプリが内部テストのドラフトでアップロードされます。
#
# 事前に`katana app keystore`でアプリ用のキーストアを作成しておいてください。
#
# また、GooglePlayConsoleでアプリを作成し、aabファイルの初回アップロード、アプリの設定でストア掲載情報設定以外を済ませておいてください。
name: AndroidProductionWorkflow
on:
# This workflow runs when there is a push on the publish branch.
Expand Down Expand Up @@ -113,7 +132,7 @@ jobs:
# Upload the generated files.
# 生成されたファイルのアップロード。
- name: Upload apk artifacts
uses: actions/upload-artifact@v2.2.0
uses: actions/upload-artifact@v2
with:
name: andoroid_apk_release
path: ./build/app/outputs/apk/release
Expand All @@ -122,19 +141,23 @@ jobs:
# Upload the generated files.
# 生成されたファイルのアップロード。
- name: Upload aab artifacts
uses: actions/upload-artifact@v2.2.0
uses: actions/upload-artifact@v2
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
# Upload to Google Play Store.
# Google Play Storeにアップロード。
- name: Deploy to Google Play Store
id: deploy
uses: r0adkll/upload-google-play@v1
with:
track: internal
status: draft
serviceAccountJson: android/service_account_key.json
packageName: #### REPLACE_ANDROID_PACKAGE_NAME ####
releaseFiles: ./build/app/outputs/bundle/release/*.aab
""";
}
}
23 changes: 22 additions & 1 deletion packages/katana_cli/lib/code/github_actions/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,28 @@ class GithubActionsIOSCliCode extends CliCode {
@override
String body(String path, String baseName, String className) {
return r"""
name: IOS Production Workflow
# Build and upload a Flutter IOS app.
#
# Nothing is stored in Github storage.
#
# Create a `CertificateSigningRequest.certSigningRequest` with `katana app csr` in advance and download the Apple Development Certificate.
#
# Create an AuthKey in AppStoreConnect and put the Issuer ID and Team ID in katana.yaml.
#
# Also, please make sure you have created your app in AppStoreConnect.
#
# FlutterのIOSアプリをビルドしアップロードします。
#
# Githubのストレージにはなにも保管されません。
#
# AppStoreConnectへアプリがアップロードされます。
#
# 事前に`katana app csr`で`CertificateSigningRequest.certSigningRequest`を作成し、Apple DevelopmentのCertificateをダウンロードしてください。
#
# AppStoreConnectでAuthKeyを作成し、Issuer IDとチームIDをkatana.yamlに記載しておきます。
#
# また、AppStoreConnectでアプリを作成しておいてください。
name: IOSProductionWorkflow
on:
# This workflow runs when there is a push on the publish branch.
Expand Down
110 changes: 110 additions & 0 deletions packages/katana_cli/lib/code/github_actions/web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
part of katana_cli;

/// Contents of buiod.yaml for Github Actions web.
///
/// Github ActionsのWeb用のbuiod.yamlの中身。
class GithubActionsWebCliCode extends CliCode {
/// Contents of buiod.yaml for Github Actions web.
///
/// Github ActionsのWeb用のbuiod.yamlの中身。
const GithubActionsWebCliCode();

@override
String get name => "build_web";

@override
String get prefix => "build_web";

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

@override
String get description =>
"Create a buiod.yaml for Github Actions for the web, please set up Firebase in advance to upload to Firebase hosting. Github ActionsのWeb用のbuiod.yamlを作成します。Firebase hostingにアップロードするため事前にFirebaseの設定を行ってください。";

@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"""
# Build and upload a Flutter web app.
#
# The built related files will be stored in Github storage. (storage expires in 1 day)
#
# FlutterのWebアプリをビルドしアップロードします。
#
# ビルドされた関連ファイルがGithubのストレージに保管されます。(保管期限1日)
name: WebProductionWorkflow
on:
# This workflow runs when there is a push on the publish branch.
# publish branch に push があったらこの workflow が走る。
push:
branches: [ publish ]
jobs:
# ----------------------------------------------------------------- #
# Build for Web
# ----------------------------------------------------------------- #
build_web:
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 web files.
# Webファイルを生成。
- name: Building web build
run: flutter build web --build-number ${GITHUB_RUN_NUMBER} --release --dart-define=FLAVOR=prod --web-renderer html
# Upload the generated files.
# 生成されたファイルのアップロード。
- name: Upload aab artifacts
uses: actions/upload-artifact@v2
with:
name: web_release
path: ./build/web
retention-days: 1
""";
}
}

0 comments on commit e20a50d

Please sign in to comment.