From 6f2904c76cc460b3514a57ac7bb23bee2026e565 Mon Sep 17 00:00:00 2001 From: luongvo Date: Tue, 1 Aug 2023 03:48:22 +0000 Subject: [PATCH 01/53] Bump version to 1.11.0 --- mason-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mason-config.json b/mason-config.json index 0406f338..90f6e06f 100644 --- a/mason-config.json +++ b/mason-config.json @@ -2,7 +2,7 @@ "project_name": "flutter_templates", "package_name": "co.nimblehq.flutter.template", "app_name": "Flutter Templates", - "app_version": "1.10.0", + "app_version": "1.11.0", "build_number": "1", "json_field_rename_format": "snake", "add_permission_handler": true From 39f1465c086538e08cb88562713a1b04a2731984 Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Tue, 1 Aug 2023 14:09:07 +0700 Subject: [PATCH 02/53] [#227] Update codeowners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ec0a83b1..20992b67 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,6 @@ # Team # @luongvo is the Team Lead -* @luongvo @manh-t @markgravity @sleepylee @chornerman @doannimble @hoangnguyen92dn @nmint8m @ducbm051291 @thiennguyen0196 @kaungkhantsoe @Shayokh144 @Tuubz @Wadeewee +* @luongvo @manh-t @markgravity @sleepylee @chornerman @doannimble @hoangnguyen92dn @nmint8m @ducbm051291 @thiennguyen0196 @kaungkhantsoe @Shayokh144 @toby-thanathip @Wadeewee # Engineering Leads CODEOWNERS @nimblehq/engineering-leads From 5b50d94b205d10c2d18e217298b2d2998d95c653 Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Tue, 1 Aug 2023 14:11:11 +0700 Subject: [PATCH 03/53] [#227] Sync latest GitHub templates from the git-template --- .github/ISSUE_TEMPLATE/bug_template.md | 8 +++---- .github/ISSUE_TEMPLATE/chore_template.md | 6 ++--- .github/ISSUE_TEMPLATE/feature_template.md | 4 ++-- .github/ISSUE_TEMPLATE/story_template.md | 22 +++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 9 ++++---- .../.github/ISSUE_TEMPLATE/bug_template.md | 8 +++---- .../.github/ISSUE_TEMPLATE/chore_template.md | 6 ++--- .../ISSUE_TEMPLATE/feature_template.md | 4 ++-- .../.github/PULL_REQUEST_TEMPLATE.md | 9 ++++---- .../.github/wiki/.keep | 0 .../.github/workflows/publish_wiki.yml | 19 ++++++++++++++++ 11 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/story_template.md create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/wiki/.keep create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/publish_wiki.yml diff --git a/.github/ISSUE_TEMPLATE/bug_template.md b/.github/ISSUE_TEMPLATE/bug_template.md index 5eb84c37..18943b88 100644 --- a/.github/ISSUE_TEMPLATE/bug_template.md +++ b/.github/ISSUE_TEMPLATE/bug_template.md @@ -7,12 +7,12 @@ labels: "type : bug" ## Issue -Describe the issue you are facing. Show us the implementation: screenshots, gif, etc. - +Describe the issue you are facing. Show us the implementation: screenshots, GIFs, etc. + ## Expected -Describe what should be the correct behaviour. - +Describe what should be the correct behavior. + ## Steps to reproduce 1. diff --git a/.github/ISSUE_TEMPLATE/chore_template.md b/.github/ISSUE_TEMPLATE/chore_template.md index bb36ec26..31da9ba4 100644 --- a/.github/ISSUE_TEMPLATE/chore_template.md +++ b/.github/ISSUE_TEMPLATE/chore_template.md @@ -1,14 +1,14 @@ --- name: "Chore" -about: "Open a Chore for minor update." +about: "Open a chore issue for a minor update." title: "Update " labels: "type : chore" --- ## Why -Describe the update details and why it's needed. - +Describe the update in detail and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/.github/ISSUE_TEMPLATE/feature_template.md b/.github/ISSUE_TEMPLATE/feature_template.md index 5a26eb96..3b009dfa 100644 --- a/.github/ISSUE_TEMPLATE/feature_template.md +++ b/.github/ISSUE_TEMPLATE/feature_template.md @@ -7,8 +7,8 @@ labels: "type : feature" ## Why -Describe the big picture of the feature and why it's needed. - +Describe the big picture of the feature and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/.github/ISSUE_TEMPLATE/story_template.md b/.github/ISSUE_TEMPLATE/story_template.md new file mode 100644 index 00000000..9d5c1108 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/story_template.md @@ -0,0 +1,22 @@ +--- +name: "Story" +about: "Open a feature story" +title: "[Type] As a user, I can " +labels: "type : feature" +--- + +## Why + +Describe the idea of the user story as in what the motive of the user story is. + +## Acceptance Criteria + +List down how the user story will be tested and what criteria are necessary for the user story to be accepted. + +## Design + +(Optional) Add design screenshots or Figma links for UI/UX-related stories. + +## Resources + +(Optional) Add useful resources such as links to documentation, implementation ideas, or best practices. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cebc58c5..f917e222 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,19 +3,18 @@ template, e.g. `{Github PR URL}?template=release_template.md` -- -- Solves # +- Close # ## What happened 👀 -Describe the big picture of your changes here to communicate to the team why we should accept this pull request. +Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress. ## Insight 📝 -Describe in details how to test the changes, which solution you tried but did not go with, referenced documentation is -welcome as well. +Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well. ## Proof Of Work 📹 -Show us the implementation: screenshots, gif, etc. +Show us the implementation: screenshots, GIFs, etc. diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/bug_template.md b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/bug_template.md index 5eb84c37..18943b88 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/bug_template.md +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/bug_template.md @@ -7,12 +7,12 @@ labels: "type : bug" ## Issue -Describe the issue you are facing. Show us the implementation: screenshots, gif, etc. - +Describe the issue you are facing. Show us the implementation: screenshots, GIFs, etc. + ## Expected -Describe what should be the correct behaviour. - +Describe what should be the correct behavior. + ## Steps to reproduce 1. diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/chore_template.md b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/chore_template.md index bb36ec26..31da9ba4 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/chore_template.md +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/chore_template.md @@ -1,14 +1,14 @@ --- name: "Chore" -about: "Open a Chore for minor update." +about: "Open a chore issue for a minor update." title: "Update " labels: "type : chore" --- ## Why -Describe the update details and why it's needed. - +Describe the update in detail and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/feature_template.md b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/feature_template.md index 5a26eb96..3b009dfa 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/feature_template.md +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/ISSUE_TEMPLATE/feature_template.md @@ -7,8 +7,8 @@ labels: "type : feature" ## Why -Describe the big picture of the feature and why it's needed. - +Describe the big picture of the feature and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/PULL_REQUEST_TEMPLATE.md b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/PULL_REQUEST_TEMPLATE.md index 8493e07c..df3ff384 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/PULL_REQUEST_TEMPLATE.md +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/PULL_REQUEST_TEMPLATE.md @@ -1,16 +1,15 @@ -https://github.com/nimblehq/{{project_name.paramCase()}}/issues/?? +- Close # ## What happened 👀 -Describe the big picture of your changes here to communicate to the team why we should accept this pull request. +Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress. ## Insight 📝 -Describe in details how to test the changes, which solution you tried but did not go with, referenced documentation is -welcome as well. +Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well. ## Proof Of Work 📹 -Show us the implementation: screenshots, gif, etc. +Show us the implementation: screenshots, GIFs, etc. diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/wiki/.keep b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/wiki/.keep new file mode 100644 index 00000000..e69de29b diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/publish_wiki.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/publish_wiki.yml new file mode 100644 index 00000000..07f9b16d --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/publish_wiki.yml @@ -0,0 +1,19 @@ +# For setup instruction, refer to https://github.com/nimblehq/github-actions-workflows/blob/main/.github/workflows/publish_wiki.yml +name: Publish Wiki + +on: + push: + paths: + - .github/wiki/** + branches: + - develop + +jobs: + publish: + name: Publish Wiki + uses: nimblehq/github-actions-workflows/.github/workflows/publish_wiki.yml@0.1.0 + with: + USER_NAME: github-wiki-workflow + USER_EMAIL: ${{#mustacheCase}}secrets.GH_EMAIL{{/mustacheCase}} + secrets: + USER_TOKEN: ${{#mustacheCase}}secrets.GH_TOKEN{{/mustacheCase}} From d83dadb7afe8fa85152c35874bf798a81ccd283a Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Tue, 1 Aug 2023 14:36:42 +0700 Subject: [PATCH 04/53] [#227] Sync the latest publish_wiki workflow --- .github/wiki/Generating-A-Project.md | 11 ----------- .github/wiki/Home.md | 1 + .github/wiki/_Sidebar.md | 7 +++++++ .github/workflows/publish_docs_to_wiki.yml | 8 +++++--- 4 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 .github/wiki/Generating-A-Project.md create mode 100644 .github/wiki/Home.md create mode 100644 .github/wiki/_Sidebar.md diff --git a/.github/wiki/Generating-A-Project.md b/.github/wiki/Generating-A-Project.md deleted file mode 100644 index 28c73951..00000000 --- a/.github/wiki/Generating-A-Project.md +++ /dev/null @@ -1,11 +0,0 @@ -# Generating a project - -## The available configs -| Parameter name | Is mandatory | Description | -| :------------- | :----------: | :------------------------------------------------------------------------------ | -| PACKAGE_NAME | Yes | The application package name. The naming convention follows `com.your.package` | -| PROJECT_NAME | Yes | The application project name. The naming convention follows `your_project_name` | -| APP_NAME | Yes | The application name. | -| APP_VERSION | No | The app version that is set when initialize the project. Default is `0.1.0` | -| BUILD_NUMBER | No | The build number that is set when initialize the project. Default is `1` | -| json_serializable.field_rename | No | Defines the automatic naming strategy when converting class field names into JSON map keys.
Available options:
- `none`: Use the field name without changes.
- `kebab`: Encodes a field named `kebabCase` with a JSON key `kebab-case`.
- `snake`: Encodes a field named `snakeCase` with a JSON key `snake_case`.
- `pascal`: Encodes a field named `pascalCase` with a JSON key `PascalCase`. | diff --git a/.github/wiki/Home.md b/.github/wiki/Home.md new file mode 100644 index 00000000..21fb545a --- /dev/null +++ b/.github/wiki/Home.md @@ -0,0 +1 @@ +Welcome to the Flutter-Templates wiki! diff --git a/.github/wiki/_Sidebar.md b/.github/wiki/_Sidebar.md new file mode 100644 index 00000000..bba35457 --- /dev/null +++ b/.github/wiki/_Sidebar.md @@ -0,0 +1,7 @@ +# Table of Contents + +- [[Home]] + +## Infrastructure + +- [[Deployment]] diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml index b39ed12f..a3304b93 100644 --- a/.github/workflows/publish_docs_to_wiki.yml +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -1,13 +1,15 @@ -name: Publish docs to Wiki +# For setup instruction, refer to https://github.com/nimblehq/github-actions-workflows/blob/main/.github/workflows/publish_wiki.yml +name: Publish Wiki + on: push: paths: - .github/wiki/** branches: - - main + - develop jobs: - publish_docs_to_wiki: + publish_wiki: name: Publish Wiki uses: nimblehq/github-actions-workflows/.github/workflows/publish_wiki.yml@0.1.0 with: From c579c6cabd764a5b326c57aac220bec0e193da22 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Tue, 1 Aug 2023 08:55:09 +0000 Subject: [PATCH 05/53] [Chore] Generate & update sample project --- sample/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/pubspec.yaml b/sample/pubspec.yaml index 59e6ca74..406a08b5 100644 --- a/sample/pubspec.yaml +++ b/sample/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.10.0+1 +version: 1.11.0+1 environment: sdk: '>=3.0.0 <4.0.0' From b2851fdae0687015c2fb1ca95f2d8b3205df1a17 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Thu, 3 Aug 2023 02:01:29 +0000 Subject: [PATCH 06/53] [Chore] Generate & update sample project --- sample/.github/ISSUE_TEMPLATE/bug_template.md | 8 ++++---- .../.github/ISSUE_TEMPLATE/chore_template.md | 6 +++--- .../ISSUE_TEMPLATE/feature_template.md | 4 ++-- sample/.github/PULL_REQUEST_TEMPLATE.md | 9 ++++----- sample/.github/wiki/.keep | 0 sample/.github/workflows/publish_wiki.yml | 19 +++++++++++++++++++ 6 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 sample/.github/wiki/.keep create mode 100644 sample/.github/workflows/publish_wiki.yml diff --git a/sample/.github/ISSUE_TEMPLATE/bug_template.md b/sample/.github/ISSUE_TEMPLATE/bug_template.md index 5eb84c37..18943b88 100644 --- a/sample/.github/ISSUE_TEMPLATE/bug_template.md +++ b/sample/.github/ISSUE_TEMPLATE/bug_template.md @@ -7,12 +7,12 @@ labels: "type : bug" ## Issue -Describe the issue you are facing. Show us the implementation: screenshots, gif, etc. - +Describe the issue you are facing. Show us the implementation: screenshots, GIFs, etc. + ## Expected -Describe what should be the correct behaviour. - +Describe what should be the correct behavior. + ## Steps to reproduce 1. diff --git a/sample/.github/ISSUE_TEMPLATE/chore_template.md b/sample/.github/ISSUE_TEMPLATE/chore_template.md index bb36ec26..31da9ba4 100644 --- a/sample/.github/ISSUE_TEMPLATE/chore_template.md +++ b/sample/.github/ISSUE_TEMPLATE/chore_template.md @@ -1,14 +1,14 @@ --- name: "Chore" -about: "Open a Chore for minor update." +about: "Open a chore issue for a minor update." title: "Update " labels: "type : chore" --- ## Why -Describe the update details and why it's needed. - +Describe the update in detail and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/sample/.github/ISSUE_TEMPLATE/feature_template.md b/sample/.github/ISSUE_TEMPLATE/feature_template.md index 5a26eb96..3b009dfa 100644 --- a/sample/.github/ISSUE_TEMPLATE/feature_template.md +++ b/sample/.github/ISSUE_TEMPLATE/feature_template.md @@ -7,8 +7,8 @@ labels: "type : feature" ## Why -Describe the big picture of the feature and why it's needed. - +Describe the big picture of the feature and why it is needed. + ## Who Benefits? Describe who will be the beneficiaries e.g. everyone, specific chapters, clients... diff --git a/sample/.github/PULL_REQUEST_TEMPLATE.md b/sample/.github/PULL_REQUEST_TEMPLATE.md index 7ac2c256..df3ff384 100644 --- a/sample/.github/PULL_REQUEST_TEMPLATE.md +++ b/sample/.github/PULL_REQUEST_TEMPLATE.md @@ -1,16 +1,15 @@ -https://github.com/nimblehq/sample/issues/?? +- Close # ## What happened 👀 -Describe the big picture of your changes here to communicate to the team why we should accept this pull request. +Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress. ## Insight 📝 -Describe in details how to test the changes, which solution you tried but did not go with, referenced documentation is -welcome as well. +Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well. ## Proof Of Work 📹 -Show us the implementation: screenshots, gif, etc. +Show us the implementation: screenshots, GIFs, etc. diff --git a/sample/.github/wiki/.keep b/sample/.github/wiki/.keep new file mode 100644 index 00000000..e69de29b diff --git a/sample/.github/workflows/publish_wiki.yml b/sample/.github/workflows/publish_wiki.yml new file mode 100644 index 00000000..6016ebc8 --- /dev/null +++ b/sample/.github/workflows/publish_wiki.yml @@ -0,0 +1,19 @@ +# For setup instruction, refer to https://github.com/nimblehq/github-actions-workflows/blob/main/.github/workflows/publish_wiki.yml +name: Publish Wiki + +on: + push: + paths: + - .github/wiki/** + branches: + - develop + +jobs: + publish: + name: Publish Wiki + uses: nimblehq/github-actions-workflows/.github/workflows/publish_wiki.yml@0.1.0 + with: + USER_NAME: github-wiki-workflow + USER_EMAIL: ${{ secrets.GH_EMAIL }} + secrets: + USER_TOKEN: ${{ secrets.GH_TOKEN }} From a6311789e245dc7a3f503e7816a321e61f3405ee Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Thu, 3 Aug 2023 10:34:54 +0700 Subject: [PATCH 07/53] [#226] Remove unnecessary token when checking out in bump_version workflow --- .github/workflows/bump_version.yml | 2 -- .../.github/workflows/bump_version.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml index 60a5a0e8..1fe55eb4 100644 --- a/.github/workflows/bump_version.yml +++ b/.github/workflows/bump_version.yml @@ -16,8 +16,6 @@ jobs: steps: - name: Check out uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Set new version uses: jossef/action-set-json-field@v2.1 diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/bump_version.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/bump_version.yml index 9db57a63..05ddfe9f 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/bump_version.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/bump_version.yml @@ -16,8 +16,6 @@ jobs: steps: - name: Check out uses: actions/checkout@v3 - with: - token: ${{#mustacheCase}}secrets.GITHUB_TOKEN{{/mustacheCase}} - name: Set new version run: | From 42d175800b6e264b47c0f12b0ee85a2adcabb650 Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Tue, 1 Aug 2023 11:08:28 +0700 Subject: [PATCH 08/53] [#226] Move some secrets to the Environments config --- .github/wiki/Deployment.md | 2 +- .github/workflows/android_deploy_production.yml | 7 ++++--- .../workflows/android_deploy_production_to_playstore.yml | 9 +++++---- .github/workflows/android_deploy_staging.yml | 8 ++++---- .github/workflows/ios_deploy_staging_to_firebase.yml | 7 ++++--- .../.github/workflows/android_deploy_production.yml | 7 ++++--- .../workflows/android_deploy_production_to_playstore.yml | 9 +++++---- .../.github/workflows/android_deploy_staging.yml | 7 ++++--- .../.github/workflows/ios_deploy_staging_to_firebase.yml | 7 ++++--- .../.github/workflows/ios_deploy_to_app_store.yml | 1 + .../.github/workflows/ios_deploy_to_testflight.yml | 1 + 11 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/wiki/Deployment.md b/.github/wiki/Deployment.md index 96a244d6..498fc157 100644 --- a/.github/wiki/Deployment.md +++ b/.github/wiki/Deployment.md @@ -10,7 +10,7 @@ - A new app on Play Store. - Add these variables as the secrets of CI: - - **ENV_PRODUCTION**: the production .env configuration file content. + - **ENV**: the production .env configuration file content. - **GOOGLE_PLAY_SERVICE_ACCOUNT_JSON**: the json file content of the Play Store's Service Account for app publishing. Please check out [how to create the Service Account](https://support.staffbase.com/hc/en-us/articles/360018569579-Preparing-Automated-Publishing-for-Google-Play-Store). ### Resources diff --git a/.github/workflows/android_deploy_production.yml b/.github/workflows/android_deploy_production.yml index 9c07cc86..0d948330 100644 --- a/.github/workflows/android_deploy_production.yml +++ b/.github/workflows/android_deploy_production.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -43,9 +44,9 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -54,7 +55,7 @@ jobs: - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_PRODUCTION }} + appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} file: build/app/outputs/flutter-apk/app-production-debug.apk diff --git a/.github/workflows/android_deploy_production_to_playstore.yml b/.github/workflows/android_deploy_production_to_playstore.yml index 4c397bd4..cdeb2f09 100644 --- a/.github/workflows/android_deploy_production_to_playstore.yml +++ b/.github/workflows/android_deploy_production_to_playstore.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -43,17 +44,17 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env - name: Set up release signing configs env: ANDROID_RELEASE_KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }} - ANDROID_SIGNING_PROPERTIES_BASE64: ${{ secrets.ANDROID_SIGNING_PROPERTIES_BASE64 }} + ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }} run: | echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore - echo $ANDROID_SIGNING_PROPERTIES_BASE64 | base64 --decode > android/signing.properties + echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties - name: Build Production App Bundle run: flutter build appbundle --flavor production --release --build-number $GITHUB_RUN_NUMBER diff --git a/.github/workflows/android_deploy_staging.yml b/.github/workflows/android_deploy_staging.yml index 443f48f9..d5915c41 100644 --- a/.github/workflows/android_deploy_staging.yml +++ b/.github/workflows/android_deploy_staging.yml @@ -9,8 +9,8 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest - timeout-minutes: 30 environment: staging + timeout-minutes: 30 steps: - name: Check out uses: actions/checkout@v3 @@ -44,9 +44,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{ secrets.ENV_STAGING }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -55,7 +55,7 @@ jobs: - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_STAGING }} + appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/.github/workflows/ios_deploy_staging_to_firebase.yml b/.github/workflows/ios_deploy_staging_to_firebase.yml index e31074db..8a4e850d 100644 --- a/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_staging_app_to_firebase: name: Build And Upload iOS Staging Application To Firebase runs-on: macOS-latest + environment: staging env: TEAM_ID: ${{ secrets.TEAM_ID }} FASTLANE_USER: ${{ secrets.FASTLANE_USER }} @@ -18,7 +19,7 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} - FIREBASE_APP_ID_STAGING: ${{ secrets.FIREBASE_IOS_APP_ID_STAGING }} + FIREBASE_APP_ID_STAGING: ${{ vars.FIREBASE_IOS_APP_ID }} FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: @@ -50,9 +51,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{ secrets.ENV_STAGING }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml index 170aa819..1cb8daa7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -34,9 +35,9 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{#mustacheCase}}secrets.ENV_PRODUCTION{{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -45,7 +46,7 @@ jobs: - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{#mustacheCase}}secrets.FIREBASE_ANDROID_APP_ID_PRODUCTION{{/mustacheCase}} + appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-production-debug.apk diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml index 6f8ac006..5b9d4190 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -34,17 +35,17 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{#mustacheCase}}secrets.ENV_PRODUCTION{{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env - name: Set up release signing configs env: ANDROID_RELEASE_KEYSTORE_BASE64: ${{#mustacheCase}}secrets.ANDROID_RELEASE_KEYSTORE_BASE64{{/mustacheCase}} - ANDROID_SIGNING_PROPERTIES_BASE64: ${{#mustacheCase}}secrets.ANDROID_SIGNING_PROPERTIES_BASE64{{/mustacheCase}} + ANDROID_SIGNING_PROPERTIES: ${{#mustacheCase}}secrets.ANDROID_SIGNING_PROPERTIES{{/mustacheCase}} run: | echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore - echo $ANDROID_SIGNING_PROPERTIES_BASE64 | base64 --decode > android/signing.properties + echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties - name: Build Production App Bundle run: flutter build appbundle --flavor production --release --build-number $GITHUB_RUN_NUMBER diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml index 2a6612df..d318a132 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: staging timeout-minutes: 30 steps: - name: Check out @@ -34,9 +35,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{#mustacheCase}}secrets.ENV_STAGING{{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -45,7 +46,7 @@ jobs: - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{#mustacheCase}}secrets.FIREBASE_ANDROID_APP_ID_STAGING{{/mustacheCase}} + appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml index b73edd1a..8cdcfa8e 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_staging_app_to_firebase: name: Build And Upload iOS Staging Application To Firebase runs-on: macOS-latest + environment: staging env: TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}} @@ -18,7 +19,7 @@ jobs: MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} FIREBASE_CLI_TOKEN: ${{#mustacheCase}}secrets.FIREBASE_CLI_TOKEN{{/mustacheCase}} - FIREBASE_APP_ID_STAGING: ${{#mustacheCase}}secrets.FIREBASE_IOS_APP_ID_STAGING{{/mustacheCase}} + FIREBASE_APP_ID_STAGING: ${{#mustacheCase}}vars.FIREBASE_IOS_APP_ID{{/mustacheCase}} FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: @@ -41,9 +42,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{#mustacheCase}}secrets.ENV_STAGING{{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 5dfc446a..ffc30f95 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_app_store: name: Build And Upload iOS Application To AppStore runs-on: macOS-latest + environment: staging timeout-minutes: 30 env: TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 5010b1fe..2734e4bd 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_testflight: name: Build And Upload iOS Application To TestFlight runs-on: macOS-latest + environment: staging timeout-minutes: 30 env: TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} From 24a4bc16b8fd7604cb95e2afca79a7739a0d38b5 Mon Sep 17 00:00:00 2001 From: "Luong Vo (Lucas)" Date: Thu, 3 Aug 2023 18:33:59 +0700 Subject: [PATCH 09/53] [#226] Get rid of staging postfix in iOS's fastlane --- .github/workflows/ios_deploy_staging_to_firebase.yml | 2 +- .../.github/workflows/ios_deploy_staging_to_firebase.yml | 2 +- .../ios/fastlane/Constants/Environments.rb | 4 ++-- .../{{project_name.snakeCase()}}/ios/fastlane/Fastfile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ios_deploy_staging_to_firebase.yml b/.github/workflows/ios_deploy_staging_to_firebase.yml index 8a4e850d..ac7f4d66 100644 --- a/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -19,7 +19,7 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} - FIREBASE_APP_ID_STAGING: ${{ vars.FIREBASE_IOS_APP_ID }} + FIREBASE_APP_ID: ${{ vars.FIREBASE_IOS_APP_ID }} FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml index 8cdcfa8e..4a232a86 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -19,7 +19,7 @@ jobs: MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} FIREBASE_CLI_TOKEN: ${{#mustacheCase}}secrets.FIREBASE_CLI_TOKEN{{/mustacheCase}} - FIREBASE_APP_ID_STAGING: ${{#mustacheCase}}vars.FIREBASE_IOS_APP_ID{{/mustacheCase}} + FIREBASE_APP_ID: ${{#mustacheCase}}vars.FIREBASE_IOS_APP_ID{{/mustacheCase}} FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb index 33ca0dfe..49c68679 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb @@ -23,8 +23,8 @@ def self.FIREBASE_CLI_TOKEN ENV['FIREBASE_CLI_TOKEN'] end - def self.FIREBASE_APP_ID_STAGING - ENV['FIREBASE_APP_ID_STAGING'] + def self.FIREBASE_APP_ID + ENV['FIREBASE_APP_ID'] end def self.FIREBASE_TESTER_GROUPS diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index f0520618..4d0c62ab 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -106,7 +106,7 @@ platform :ios do scheme_name: Constants.SCHEME_NAME_STAGING, product_name: Constants.PRODUCT_NAME_STAGING, bundle_id: Constants.BUNDLE_ID_STAGING, - app_id: Environments.FIREBASE_APP_ID_STAGING + app_id: Environments.FIREBASE_APP_ID ) end From c8c6983e69c8c429b5d752c5f040f51828dd9ab3 Mon Sep 17 00:00:00 2001 From: Tam Nguyen Minh Date: Tue, 1 Aug 2023 12:48:38 +0700 Subject: [PATCH 10/53] [#255] Generate sample project as a part of test workflow --- .github/workflows/generate_sample.yml | 57 --------------------------- .github/workflows/test.yml | 56 +++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/generate_sample.yml diff --git a/.github/workflows/generate_sample.yml b/.github/workflows/generate_sample.yml deleted file mode 100644 index 5a93ddce..00000000 --- a/.github/workflows/generate_sample.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Generate the sample project - -on: - push: - branches: - - develop - -jobs: - generate_sample_project: - # Run on merge commits only - if: ${{ contains(github.event.head_commit.message, 'Merge pull request') || (github.event.head_commit.author.email != 'bot@nimblehq.co') }} - name: Generate the sample project - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Check out - uses: actions/checkout@v3 - with: - token: ${{ secrets.WIKI_ACTION_TOKEN }} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Remove the old sample project - run: | - rm -rf sample - - - name: Set the project name "sample" - uses: jossef/action-set-json-field@v2.1 - with: - file: mason-config.json - field: project_name - value: sample - - - name: Generate the new sample project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - - - id: changes - name: Check for changes in the sample project - run: | - count=$(git status sample --porcelain | wc -l) - echo "count=$count" >> $GITHUB_OUTPUT - - - name: Commit & push the sample project changes - if: steps.changes.outputs.count > 0 - run: | - git config user.name team-nimblehq - git config user.email bot@nimblehq.co - git add sample - git commit -m "[Chore] Generate & update sample project" - git push diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a6ebae8..1ae97f50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,11 +4,6 @@ on: # but push action is only for the feature branch pull_request: types: [ opened, synchronize, reopened ] - push: - branches-ignore: - - develop - - 'release/**' - - main jobs: test: @@ -88,3 +83,54 @@ jobs: git add bricks git commit -m "[Chore] Generate Mason bundle" git push + + generate_sample_project: + # The job generate_sample_project identify that the job generate_mason_bundle must complete successfully + # before this generate_sample_project job will run + needs: generate_mason_bundle + name: Generate the sample project + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Check out + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Remove the old sample project + run: | + rm -rf sample + + - name: Set the project name "sample" + uses: jossef/action-set-json-field@v2.1 + with: + file: mason-config.json + field: project_name + value: sample + + - name: Generate the new sample project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + + - id: changes + name: Check for changes in the sample project + run: | + count=$(git status sample --porcelain | wc -l) + echo "count=$count" >> $GITHUB_OUTPUT + + - name: Commit & push the sample project changes + if: steps.changes.outputs.count > 0 + run: | + git config user.name team-nimblehq + git config user.email bot@nimblehq.co + git add sample + git commit -m "[Chore] Generate & update sample project" + git push From a9d7d3fd0965cb3390679d01148b066708c65243 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 2 Aug 2023 23:30:12 +0700 Subject: [PATCH 11/53] [#258] Refactor clean architecture --- .../lib/{ => app}/resources/app_colors.dart | 0 .../lib/{ => app/screens/home}/home_view_model.dart | 8 ++++---- .../lib/{ => app/screens/home}/home_view_state.dart | 0 .../errors}/network_exceptions.dart | 2 +- .../datasources/remote}/api_service.dart | 2 +- .../datasources/remote}/response/user_response.dart | 6 ++++++ .../repositories/credential_repository_impl.dart} | 13 +++++-------- .../lib/{model => domain/models}/user.dart | 8 -------- .../domain/repositories/credential_repository.dart | 5 +++++ .../{ => domain}/usecases/base/base_use_case.dart | 0 .../{ => domain}/usecases/base/use_case_result.dart | 0 .../usecases/user/get_users_use_case.dart | 8 ++++---- .../{{project_name.snakeCase()}}/lib/main.dart | 6 +++--- .../api/repository/credential_repository_test.dart | 6 +++--- .../test/mocks/generate_mocks.dart | 6 +++--- .../test/mocks/response/user_response_mocks.dart | 2 +- .../test/usecases/user/get_users_use_case_test.dart | 6 +++--- .../test/viewmodel/home_view_model_test.dart | 6 +++--- 18 files changed, 42 insertions(+), 42 deletions(-) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => app}/resources/app_colors.dart (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => app/screens/home}/home_view_model.dart (64%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => app/screens/home}/home_view_state.dart (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{api/exception => core/errors}/network_exceptions.dart (98%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{api => data/datasources/remote}/api_service.dart (80%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{api => data/datasources/remote}/response/user_response.dart (72%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{api/repository/credential_repository.dart => data/repositories/credential_repository_impl.dart} (56%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{model => domain/models}/user.dart (58%) create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/repositories/credential_repository.dart rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => domain}/usecases/base/base_use_case.dart (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => domain}/usecases/base/use_case_result.dart (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{ => domain}/usecases/user/get_users_use_case.dart (61%) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/resources/app_colors.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/resources/app_colors.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/resources/app_colors.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/resources/app_colors.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/home_view_model.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart similarity index 64% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/home_view_model.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart index 313ee7dc..12fd648b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/home_view_model.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'package:{{project_name.snakeCase()}}/home_view_state.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/user/get_users_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens//home/home_view_state.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; class HomeViewModel extends StateNotifier { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/home_view_state.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_state.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/home_view_state.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_state.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/exception/network_exceptions.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart similarity index 98% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/exception/network_exceptions.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart index 9bc1e0cc..817b100b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/exception/network_exceptions.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -part 'network_exceptions.freezed.dart'; +part '../../data/datasources/remote/exception/network_exceptions.freezed.dart'; @freezed class NetworkExceptions with _$NetworkExceptions { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/api_service.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart similarity index 80% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/api_service.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart index 60bc5696..073ddd9f 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/api_service.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:{{project_name.snakeCase()}}/api/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; import 'package:retrofit/retrofit.dart'; part 'api_service.g.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/response/user_response.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart similarity index 72% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/response/user_response.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart index 6e95125c..1c18f15a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/response/user_response.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; part 'user_response.g.dart'; @@ -13,4 +14,9 @@ class UserResponse { _$UserResponseFromJson(json); Map toJson() => _$UserResponseToJson(this); + + User toUser() => User( + email: email, + username: username, + ); } diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/repository/credential_repository.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart similarity index 56% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/repository/credential_repository.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart index f7b62485..f349379a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/api/repository/credential_repository.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart @@ -1,12 +1,9 @@ -import 'package:{{project_name.snakeCase()}}/api/api_service.dart'; -import 'package:{{project_name.snakeCase()}}/api/exception/network_exceptions.dart'; -import 'package:{{project_name.snakeCase()}}/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:injectable/injectable.dart'; -abstract class CredentialRepository { - Future> getUsers(); -} - @LazySingleton(as: CredentialRepository) class CredentialRepositoryImpl extends CredentialRepository { final BaseApiService _apiService; @@ -18,7 +15,7 @@ class CredentialRepositoryImpl extends CredentialRepository { try { final userResponses = await _apiService.getUsers(); return userResponses - .map((userResponse) => User.fromUserResponse(userResponse)) + .map((userResponse) => userResponse.toUser()) .toList(); } catch (exception) { throw NetworkExceptions.fromDioException(exception); diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/model/user.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/models/user.dart similarity index 58% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/model/user.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/models/user.dart index 644c34e5..f79c2ad7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/model/user.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/models/user.dart @@ -1,5 +1,4 @@ import 'package:equatable/equatable.dart'; -import 'package:{{project_name.snakeCase()}}/api/response/user_response.dart'; class User extends Equatable { final String email; @@ -10,13 +9,6 @@ class User extends Equatable { required this.username, }); - factory User.fromUserResponse(UserResponse response) { - return User( - email: response.email, - username: response.username, - ); - } - @override bool? get stringify => true; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/repositories/credential_repository.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/repositories/credential_repository.dart new file mode 100644 index 00000000..78b1acfd --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/repositories/credential_repository.dart @@ -0,0 +1,5 @@ +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; + +abstract class CredentialRepository { + Future> getUsers(); +} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/base/base_use_case.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/base/base_use_case.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/base/base_use_case.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/base/base_use_case.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/base/use_case_result.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/base/use_case_result.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/base/use_case_result.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/base/use_case_result.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/user/get_users_use_case.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/user/get_users_use_case.dart similarity index 61% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/user/get_users_use_case.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/user/get_users_use_case.dart index 0967e82e..567c22c1 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/usecases/user/get_users_use_case.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/user/get_users_use_case.dart @@ -1,7 +1,7 @@ -import 'package:{{project_name.snakeCase()}}/api/exception/network_exceptions.dart'; -import 'package:{{project_name.snakeCase()}}/api/repository/credential_repository.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:injectable/injectable.dart'; @Injectable() diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart index 670fdfb5..4d9e94bb 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart @@ -6,10 +6,10 @@ import 'package:go_router/go_router.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:{{project_name.snakeCase()}}/di/di.dart'; import 'package:{{project_name.snakeCase()}}/gen/assets.gen.dart'; -import 'package:{{project_name.snakeCase()}}/resources/app_colors.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/app/resources/app_colors.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; -import 'home_view_model.dart'; import 'home_view_state.dart'; void main() async { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart index 4f55260a..823d7186 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart @@ -1,6 +1,6 @@ -import 'package:{{project_name.snakeCase()}}/api/exception/network_exceptions.dart'; -import 'package:{{project_name.snakeCase()}}/api/repository/credential_repository.dart'; -import 'package:{{project_name.snakeCase()}}/api/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart index ae4439d8..02cfad9a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart @@ -1,7 +1,7 @@ import 'package:dio/dio.dart'; -import 'package:{{project_name.snakeCase()}}/api/api_service.dart'; -import 'package:{{project_name.snakeCase()}}/api/repository/credential_repository.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; import 'package:mockito/annotations.dart'; @GenerateMocks([ diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart index b7137346..f3f2c602 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/api/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; class UserResponseMocks { static UserResponse mock() { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart index 2350f6b9..ccb2123a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart @@ -1,8 +1,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/user/get_users_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import '../../mocks/generate_mocks.mocks.dart'; import '../../mocks/response/user_response_mocks.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart index 37f8a291..adc3e015 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart @@ -1,10 +1,10 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; -import 'package:{{project_name.snakeCase()}}/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/home_view_model.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:{{project_name.snakeCase()}}/main.dart'; -import 'package:{{project_name.snakeCase()}}/model/user.dart'; import '../mocks/generate_mocks.mocks.dart'; import '../mocks/response/user_response_mocks.dart'; From 8d0e89c81edaaf8f60457ed64e05feb2208f5813 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 2 Aug 2023 23:46:37 +0700 Subject: [PATCH 12/53] [#258] Update network module path --- .../lib/di/module/network_module.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart index 23857658..5cb82a58 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/api/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; import 'package:{{project_name.snakeCase()}}/env.dart'; import 'package:{{project_name.snakeCase()}}/di/provider/dio_provider.dart'; import 'package:injectable/injectable.dart'; From 5cdb464858b208a090743db89bed2c9f3eafa747 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 2 Aug 2023 23:49:51 +0700 Subject: [PATCH 13/53] [#258] Format code --- .../lib/data/datasources/remote/response/user_response.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart index 1c18f15a..79f44fc3 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart @@ -16,7 +16,7 @@ class UserResponse { Map toJson() => _$UserResponseToJson(this); User toUser() => User( - email: email, - username: username, - ); + email: email, + username: username, + ); } From e34ecb49b7c0f73a431dcaa4e814714fd29f466d Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 3 Aug 2023 00:00:49 +0700 Subject: [PATCH 14/53] [#258] Update paths --- .../lib/core/errors/network_exceptions.dart | 2 +- .../lib/data/repositories/credential_repository_impl.dart | 2 +- .../__brick__/{{project_name.snakeCase()}}/lib/main.dart | 3 +-- .../test/api/repository/credential_repository_test.dart | 1 + .../test/usecases/user/get_users_use_case_test.dart | 2 +- .../test/viewmodel/home_view_model_test.dart | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart index 817b100b..9bc1e0cc 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -part '../../data/datasources/remote/exception/network_exceptions.freezed.dart'; +part 'network_exceptions.freezed.dart'; @freezed class NetworkExceptions with _$NetworkExceptions { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart index f349379a..ce908f9b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart @@ -1,6 +1,6 @@ import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; -import 'package:{{project_name.snakeCase()}}/domain/model/user.dart'; +import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:injectable/injectable.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart index 4d9e94bb..a78a576b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart @@ -8,10 +8,9 @@ import 'package:{{project_name.snakeCase()}}/di/di.dart'; import 'package:{{project_name.snakeCase()}}/gen/assets.gen.dart'; import 'package:{{project_name.snakeCase()}}/app/resources/app_colors.dart'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; -import 'home_view_state.dart'; - void main() async { WidgetsFlutterBinding.ensureInitialized(); await FlutterConfig.loadEnvVariables(); diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart index 823d7186..ea8efb79 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart @@ -1,5 +1,6 @@ import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; +import 'package:{{project_name.snakeCase()}}/data/repositories/credential_repository_impl.dart'; import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart index ccb2123a..604dffb9 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart @@ -19,7 +19,7 @@ void main() { test('When getting users successfully, it returns Success result', () async { - final expectedResult = [User.fromUserResponse(UserResponseMocks.mock())]; + final expectedResult = [UserResponseMocks.mock().toUser()]; when(mockRepository.getUsers()).thenAnswer((_) async => expectedResult); final result = await getUsersUseCase.call(); diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart index adc3e015..d3a070c7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart @@ -30,7 +30,7 @@ void main() { test('When calling get user list successfully, it returns correctly', () async { - final expectedResult = [User.fromUserResponse(UserResponseMocks.mock())]; + final expectedResult = [UserResponseMocks.mock().toUser()]; when(mockGetUsersUseCase.call()) .thenAnswer((_) async => Success(expectedResult)); From 35d3f8f6469ad51ef8cabc6673775cfa18076af8 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 3 Aug 2023 00:04:32 +0700 Subject: [PATCH 15/53] [#258] Remove unused imports --- .../test/usecases/user/get_users_use_case_test.dart | 1 - .../test/viewmodel/home_view_model_test.dart | 1 - 2 files changed, 2 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart index 604dffb9..802491b1 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart @@ -2,7 +2,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import '../../mocks/generate_mocks.mocks.dart'; import '../../mocks/response/user_response_mocks.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart index d3a070c7..631d50eb 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart @@ -3,7 +3,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:{{project_name.snakeCase()}}/main.dart'; import '../mocks/generate_mocks.mocks.dart'; From 5c83b6ab556c05db58ce2470deb34d68c93ecaa7 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 3 Aug 2023 00:22:04 +0700 Subject: [PATCH 16/53] [#258] Update path --- .../lib/app/screens/home/home_view_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart index 12fd648b..2070943f 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart @@ -1,5 +1,5 @@ import 'dart:async'; -import 'package:{{project_name.snakeCase()}}/app/screens//home/home_view_state.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; From 254edff542a9652821085a0e6ba28d5df06099bd Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Tue, 15 Aug 2023 15:06:15 +0700 Subject: [PATCH 17/53] [#258] Add home screen --- .../integration_test/my_home_page_test.dart | 2 +- .../integration_test/utils/test_util.dart | 2 +- .../lib/app/screens/home/home_screen.dart | 75 ++++++++++++++++++ .../lib/app/screens/home/home_view_model.dart | 2 +- .../{user => }/get_users_use_case.dart | 0 .../lib/main.dart | 79 +------------------ .../test/mocks/generate_mocks.dart | 2 +- .../user/get_users_use_case_test.dart | 2 +- .../test/viewmodel/home_view_model_test.dart | 2 +- 9 files changed, 84 insertions(+), 82 deletions(-) create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/{user => }/get_users_use_case.dart (100%) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart index abd10d71..d26d2064 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:{{project_name.snakeCase()}}/main.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart index abc6b3f2..ce1ca18a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_config/flutter_config.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:{{project_name.snakeCase()}}/main.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import 'package:package_info_plus/package_info_plus.dart'; class TestUtil { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart new file mode 100644 index 00000000..36e19983 --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart @@ -0,0 +1,75 @@ +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/main.dart'; +import 'package:flutter_config/flutter_config.dart'; + +final homeViewModelProvider = +StateNotifierProvider.autoDispose((ref) { + return HomeViewModel( + getIt.get(), + ); +}); + +class HomeScreen extends ConsumerStatefulWidget { + const HomeScreen({super.key}); + + @override + _HomeScreenState createState() => _HomeScreenState(); +} + +class _HomeScreenState extends ConsumerState { + @override + void initState() { + super.initState(); + ref.read(homeViewModelProvider.notifier).getUsers(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: FutureBuilder( + future: PackageInfo.fromPlatform(), + builder: (context, snapshot) { + return snapshot.hasData + ? Text(snapshot.data?.appName ?? "") + : const SizedBox.shrink(); + }), + ), + body: Center( + child: Column( + children: [ + const SizedBox(height: 24), + FractionallySizedBox( + widthFactor: 0.5, + child: Image.asset( + Assets.images.nimbleLogo.path, + fit: BoxFit.fitWidth, + ), + ), + const SizedBox(height: 8), + Assets.svg.flutterLogo.svg( + width: 32, + height: 32, + ), + const SizedBox(height: 24), + Text(AppLocalizations.of(context)!.hello), + Text( + FlutterConfig.get('SECRET'), + style: const TextStyle( + color: AppColors.nimblePrimaryBlue, + fontSize: 24, + ), + ), + const SizedBox(height: 24), + ElevatedButton( + onPressed: () => context.go('/$routePathSecondScreen'), + child: const Text("Navigate to Second Screen"), + ), + ], + ), + ), + ); + } +} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart index 2070943f..b11dca0e 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_view_model.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/user/get_users_use_case.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/user/get_users_use_case.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart index a78a576b..d22f6b7d 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_config/flutter_config.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; @@ -7,9 +6,7 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:{{project_name.snakeCase()}}/di/di.dart'; import 'package:{{project_name.snakeCase()}}/gen/assets.gen.dart'; import 'package:{{project_name.snakeCase()}}/app/resources/app_colors.dart'; -import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; -import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; -import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -33,12 +30,12 @@ class MyApp extends StatelessWidget { GoRoute( path: routePathRootScreen, builder: (BuildContext context, GoRouterState state) => - const HomeScreen(), + const HomeScreen(), routes: [ GoRoute( path: routePathSecondScreen, builder: (BuildContext context, GoRouterState state) => - const SecondScreen(), + const SecondScreen(), ), ], ), @@ -62,76 +59,6 @@ class MyApp extends StatelessWidget { } } -final homeViewModelProvider = - StateNotifierProvider.autoDispose((ref) { - return HomeViewModel( - getIt.get(), - ); -}); - -class HomeScreen extends ConsumerStatefulWidget { - const HomeScreen({super.key}); - - @override - HomeScreenState createState() => HomeScreenState(); -} - -class HomeScreenState extends ConsumerState { - @override - void initState() { - super.initState(); - ref.read(homeViewModelProvider.notifier).getUsers(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: FutureBuilder( - future: PackageInfo.fromPlatform(), - builder: (context, snapshot) { - return snapshot.hasData - ? Text(snapshot.data?.appName ?? "") - : const SizedBox.shrink(); - }), - ), - body: Center( - child: Column( - children: [ - const SizedBox(height: 24), - FractionallySizedBox( - widthFactor: 0.5, - child: Image.asset( - Assets.images.nimbleLogo.path, - fit: BoxFit.fitWidth, - ), - ), - const SizedBox(height: 8), - Assets.svg.flutterLogo.svg( - width: 32, - height: 32, - ), - const SizedBox(height: 24), - Text(AppLocalizations.of(context)!.hello), - Text( - FlutterConfig.get('SECRET'), - style: const TextStyle( - color: AppColors.nimblePrimaryBlue, - fontSize: 24, - ), - ), - const SizedBox(height: 24), - ElevatedButton( - onPressed: () => context.go('/$routePathSecondScreen'), - child: const Text("Navigate to Second Screen"), - ), - ], - ), - ), - ); - } -} - class SecondScreen extends StatelessWidget { const SecondScreen({ Key? key, diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart index 02cfad9a..3a4cfe4a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart @@ -1,7 +1,7 @@ import 'package:dio/dio.dart'; import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; -import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import 'package:mockito/annotations.dart'; @GenerateMocks([ diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart index 802491b1..e7b32b74 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart @@ -1,7 +1,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/domain/usecases/user/get_users_use_case.dart'; +import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import '../../mocks/generate_mocks.mocks.dart'; import '../../mocks/response/user_response_mocks.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart index 631d50eb..5789862d 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart @@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; -import 'package:{{project_name.snakeCase()}}/main.dart'; +import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import '../mocks/generate_mocks.mocks.dart'; import '../mocks/response/user_response_mocks.dart'; From acb8538e662f93f2e9c232ed0ca3cfefbe29b28b Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 16 Aug 2023 14:48:12 +0700 Subject: [PATCH 18/53] [#258] Update exception --- .../lib/data/repositories/credential_repository_impl.dart | 2 +- .../{core/errors => domain/exceptions}/network_exceptions.dart | 0 .../lib/domain/usecases/get_users_use_case.dart | 2 +- .../test/api/repository/credential_repository_test.dart | 2 +- sample/lib/api/repository/credential_repository.dart | 2 +- sample/lib/usecases/user/get_users_use_case.dart | 2 +- sample/test/api/repository/credential_repository_test.dart | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{core/errors => domain/exceptions}/network_exceptions.dart (100%) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart index ce908f9b..1bad323b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart @@ -1,5 +1,5 @@ import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; -import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:injectable/injectable.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/exceptions/network_exceptions.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/core/errors/network_exceptions.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/exceptions/network_exceptions.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart index 567c22c1..efc76ac7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/domain/usecases/get_users_use_case.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart index ea8efb79..77abe8b4 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/core/errors/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:{{project_name.snakeCase()}}/data/repositories/credential_repository_impl.dart'; import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; diff --git a/sample/lib/api/repository/credential_repository.dart b/sample/lib/api/repository/credential_repository.dart index e2792365..c3a336ef 100644 --- a/sample/lib/api/repository/credential_repository.dart +++ b/sample/lib/api/repository/credential_repository.dart @@ -1,5 +1,5 @@ import 'package:sample/api/api_service.dart'; -import 'package:sample/api/exception/network_exceptions.dart'; +import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:sample/model/user.dart'; import 'package:injectable/injectable.dart'; diff --git a/sample/lib/usecases/user/get_users_use_case.dart b/sample/lib/usecases/user/get_users_use_case.dart index 4ec6e859..296fbb6b 100644 --- a/sample/lib/usecases/user/get_users_use_case.dart +++ b/sample/lib/usecases/user/get_users_use_case.dart @@ -1,4 +1,4 @@ -import 'package:sample/api/exception/network_exceptions.dart'; +import 'package:sample/domain/exceptions/network_exceptions.dart'; import 'package:sample/api/repository/credential_repository.dart'; import 'package:sample/usecases/base/base_use_case.dart'; import 'package:sample/model/user.dart'; diff --git a/sample/test/api/repository/credential_repository_test.dart b/sample/test/api/repository/credential_repository_test.dart index 9060992c..8357b6bd 100644 --- a/sample/test/api/repository/credential_repository_test.dart +++ b/sample/test/api/repository/credential_repository_test.dart @@ -1,4 +1,4 @@ -import 'package:sample/api/exception/network_exceptions.dart'; +import 'package:sample/domain/exceptions/network_exceptions.dart'; import 'package:sample/api/repository/credential_repository.dart'; import 'package:sample/api/response/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; From 3c414adda12b156343087a1b82a67fbe35a3af06 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 16 Aug 2023 17:06:42 +0700 Subject: [PATCH 19/53] [#258] Refactor test package --- .../{datasources/remote => remote/datasources}/api_service.dart | 2 +- .../response => remote/models/responses}/user_response.dart | 0 .../lib/data/repositories/credential_repository_impl.dart | 2 +- .../lib/di/module/network_module.dart | 2 +- .../{viewmodel => app/screens/home}/home_view_model_test.dart | 2 +- .../repositories}/credential_repository_test.dart | 2 +- .../user => domain/usecases}/get_users_use_case_test.dart | 2 +- .../remote/models/responses}/user_response_mocks.dart | 2 +- .../{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart | 2 +- sample/lib/api/api_service.dart | 2 +- sample/lib/api/repository/credential_repository.dart | 2 +- sample/lib/di/module/network_module.dart | 2 +- sample/lib/model/user.dart | 2 +- sample/test/api/repository/credential_repository_test.dart | 2 +- sample/test/mocks/generate_mocks.dart | 2 +- sample/test/mocks/response/user_response_mocks.dart | 2 +- sample/test/usecases/user/get_users_use_case_test.dart | 2 +- sample/test/viewmodel/home_view_model_test.dart | 2 +- 18 files changed, 17 insertions(+), 17 deletions(-) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/{datasources/remote => remote/datasources}/api_service.dart (80%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/{datasources/remote/response => remote/models/responses}/user_response.dart (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/test/{viewmodel => app/screens/home}/home_view_model_test.dart (95%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/test/{api/repository => data/repositories}/credential_repository_test.dart (93%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/test/{usecases/user => domain/usecases}/get_users_use_case_test.dart (92%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/{response => data/remote/models/responses}/user_response_mocks.dart (56%) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/datasources/api_service.dart similarity index 80% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/datasources/api_service.dart index 073ddd9f..74a78035 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/api_service.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/datasources/api_service.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/models/responses/user_response.dart'; import 'package:retrofit/retrofit.dart'; part 'api_service.g.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/models/responses/user_response.dart similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/datasources/remote/response/user_response.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/models/responses/user_response.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart index 1bad323b..1bdc1152 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/repositories/credential_repository_impl.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/datasources/api_service.dart'; import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/models/user.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart index 5cb82a58..15ba167b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/network_module.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/datasources/api_service.dart'; import 'package:{{project_name.snakeCase()}}/env.dart'; import 'package:{{project_name.snakeCase()}}/di/provider/dio_provider.dart'; import 'package:injectable/injectable.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart similarity index 95% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart index 5789862d..450da5fb 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/viewmodel/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart @@ -6,7 +6,7 @@ import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case. import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import '../mocks/generate_mocks.mocks.dart'; -import '../mocks/response/user_response_mocks.dart'; +import '../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group("HomeViewModelTest", () { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/data/repositories/credential_repository_test.dart similarity index 93% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/test/data/repositories/credential_repository_test.dart index 77abe8b4..03635a9c 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/api/repository/credential_repository_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/data/repositories/credential_repository_test.dart @@ -1,7 +1,7 @@ import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:{{project_name.snakeCase()}}/data/repositories/credential_repository_impl.dart'; -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/models/responses/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/domain/usecases/get_users_use_case_test.dart similarity index 92% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/test/domain/usecases/get_users_use_case_test.dart index e7b32b74..fafe3868 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/usecases/user/get_users_use_case_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/domain/usecases/get_users_use_case_test.dart @@ -4,7 +4,7 @@ import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case. import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import '../../mocks/generate_mocks.mocks.dart'; -import '../../mocks/response/user_response_mocks.dart'; +import '../../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group('GetUsersUseCase', () { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/data/remote/models/responses/user_response_mocks.dart similarity index 56% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/data/remote/models/responses/user_response_mocks.dart index f3f2c602..1c0859c0 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/response/user_response_mocks.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/data/remote/models/responses/user_response_mocks.dart @@ -1,4 +1,4 @@ -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/response/user_response.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/models/responses/user_response.dart'; class UserResponseMocks { static UserResponse mock() { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart index 3a4cfe4a..182872de 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/mocks/generate_mocks.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:{{project_name.snakeCase()}}/data/datasources/remote/api_service.dart'; +import 'package:{{project_name.snakeCase()}}/data/remote/datasources/api_service.dart'; import 'package:{{project_name.snakeCase()}}/domain/repositories/credential_repository.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import 'package:mockito/annotations.dart'; diff --git a/sample/lib/api/api_service.dart b/sample/lib/api/api_service.dart index 99773067..9cd39cce 100644 --- a/sample/lib/api/api_service.dart +++ b/sample/lib/api/api_service.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:sample/api/response/user_response.dart'; +import 'package:sample/data/remote/models/responses/user_response.dart'; import 'package:retrofit/retrofit.dart'; part 'api_service.g.dart'; diff --git a/sample/lib/api/repository/credential_repository.dart b/sample/lib/api/repository/credential_repository.dart index c3a336ef..8d3cf711 100644 --- a/sample/lib/api/repository/credential_repository.dart +++ b/sample/lib/api/repository/credential_repository.dart @@ -1,4 +1,4 @@ -import 'package:sample/api/api_service.dart'; +import 'package:sample/data/remote/datasources/api_service.dart'; import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; import 'package:sample/model/user.dart'; import 'package:injectable/injectable.dart'; diff --git a/sample/lib/di/module/network_module.dart b/sample/lib/di/module/network_module.dart index af85d15f..34a2fc56 100644 --- a/sample/lib/di/module/network_module.dart +++ b/sample/lib/di/module/network_module.dart @@ -1,4 +1,4 @@ -import 'package:sample/api/api_service.dart'; +import 'package:sample/data/remote/datasources/api_service.dart'; import 'package:sample/env.dart'; import 'package:sample/di/provider/dio_provider.dart'; import 'package:injectable/injectable.dart'; diff --git a/sample/lib/model/user.dart b/sample/lib/model/user.dart index a013c40e..e1c85d39 100644 --- a/sample/lib/model/user.dart +++ b/sample/lib/model/user.dart @@ -1,5 +1,5 @@ import 'package:equatable/equatable.dart'; -import 'package:sample/api/response/user_response.dart'; +import 'package:sample/data/remote/models/responses/user_response.dart'; class User extends Equatable { final String email; diff --git a/sample/test/api/repository/credential_repository_test.dart b/sample/test/api/repository/credential_repository_test.dart index 8357b6bd..f6619ee5 100644 --- a/sample/test/api/repository/credential_repository_test.dart +++ b/sample/test/api/repository/credential_repository_test.dart @@ -1,6 +1,6 @@ import 'package:sample/domain/exceptions/network_exceptions.dart'; import 'package:sample/api/repository/credential_repository.dart'; -import 'package:sample/api/response/user_response.dart'; +import 'package:sample/data/remote/models/responses/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/sample/test/mocks/generate_mocks.dart b/sample/test/mocks/generate_mocks.dart index a9d6fb7f..87d9bb7e 100644 --- a/sample/test/mocks/generate_mocks.dart +++ b/sample/test/mocks/generate_mocks.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:sample/api/api_service.dart'; +import 'package:sample/data/remote/datasources/api_service.dart'; import 'package:sample/api/repository/credential_repository.dart'; import 'package:sample/usecases/user/get_users_use_case.dart'; import 'package:mockito/annotations.dart'; diff --git a/sample/test/mocks/response/user_response_mocks.dart b/sample/test/mocks/response/user_response_mocks.dart index 04bd282c..e70fd8ee 100644 --- a/sample/test/mocks/response/user_response_mocks.dart +++ b/sample/test/mocks/response/user_response_mocks.dart @@ -1,4 +1,4 @@ -import 'package:sample/api/response/user_response.dart'; +import 'package:sample/data/remote/models/responses/user_response.dart'; class UserResponseMocks { static UserResponse mock() { diff --git a/sample/test/usecases/user/get_users_use_case_test.dart b/sample/test/usecases/user/get_users_use_case_test.dart index c3b16e51..aab8fb84 100644 --- a/sample/test/usecases/user/get_users_use_case_test.dart +++ b/sample/test/usecases/user/get_users_use_case_test.dart @@ -5,7 +5,7 @@ import 'package:sample/usecases/user/get_users_use_case.dart'; import 'package:sample/model/user.dart'; import '../../mocks/generate_mocks.mocks.dart'; -import '../../mocks/response/user_response_mocks.dart'; +import '../../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group('GetUsersUseCase', () { diff --git a/sample/test/viewmodel/home_view_model_test.dart b/sample/test/viewmodel/home_view_model_test.dart index 1a613c9c..99089802 100644 --- a/sample/test/viewmodel/home_view_model_test.dart +++ b/sample/test/viewmodel/home_view_model_test.dart @@ -7,7 +7,7 @@ import 'package:sample/main.dart'; import 'package:sample/model/user.dart'; import '../mocks/generate_mocks.mocks.dart'; -import '../mocks/response/user_response_mocks.dart'; +import '../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group("HomeViewModelTest", () { From 221486066a20ad6ba609ba7a94c5a5cf75fbc0e1 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 16 Aug 2023 17:27:19 +0700 Subject: [PATCH 20/53] [#258] Format code --- .../lib/app/screens/home/home_screen.dart | 2 +- .../__brick__/{{project_name.snakeCase()}}/lib/main.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart index 36e19983..982528e9 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart @@ -5,7 +5,7 @@ import 'package:{{project_name.snakeCase()}}/main.dart'; import 'package:flutter_config/flutter_config.dart'; final homeViewModelProvider = -StateNotifierProvider.autoDispose((ref) { + StateNotifierProvider.autoDispose((ref) { return HomeViewModel( getIt.get(), ); diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart index d22f6b7d..f68ec5f9 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart @@ -30,12 +30,12 @@ class MyApp extends StatelessWidget { GoRoute( path: routePathRootScreen, builder: (BuildContext context, GoRouterState state) => - const HomeScreen(), + const HomeScreen(), routes: [ GoRoute( path: routePathSecondScreen, builder: (BuildContext context, GoRouterState state) => - const SecondScreen(), + const SecondScreen(), ), ], ), From 2407a6982a8566bdb0c7c139939aeca2a99d8e2a Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 20:09:43 +0700 Subject: [PATCH 21/53] [#258] Update HomeScreen state and its dependencies --- .../integration_test/utils/test_util.dart | 2 +- .../lib/app/screens/home/home_screen.dart | 10 +++++++++- .../{{project_name.snakeCase()}}/lib/main.dart | 3 +-- .../test/app/screens/home/home_view_model_test.dart | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart index ce1ca18a..83135f56 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/utils/test_util.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_config/flutter_config.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import 'package:package_info_plus/package_info_plus.dart'; +import 'package:{{project_name.snakeCase()}}/main.dart'; class TestUtil { /// This is useful when we test the whole app with the real configs(styling, diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart index 982528e9..f97572e9 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/app/screens/home/home_screen.dart @@ -2,7 +2,15 @@ import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.da import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_state.dart'; import 'package:{{project_name.snakeCase()}}/domain/usecases/get_users_use_case.dart'; import 'package:{{project_name.snakeCase()}}/main.dart'; +import 'package:{{project_name.snakeCase()}}/di/di.dart'; +import 'package:{{project_name.snakeCase()}}/gen/assets.gen.dart'; +import 'package:{{project_name.snakeCase()}}/app/resources/app_colors.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter_config/flutter_config.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:go_router/go_router.dart'; final homeViewModelProvider = StateNotifierProvider.autoDispose((ref) { @@ -15,7 +23,7 @@ class HomeScreen extends ConsumerStatefulWidget { const HomeScreen({super.key}); @override - _HomeScreenState createState() => _HomeScreenState(); + ConsumerState createState() => _HomeScreenState(); } class _HomeScreenState extends ConsumerState { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart index f68ec5f9..3e1e7ad2 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/main.dart @@ -2,10 +2,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; -import 'package:package_info_plus/package_info_plus.dart'; +import 'package:flutter_config/flutter_config.dart'; import 'package:{{project_name.snakeCase()}}/di/di.dart'; import 'package:{{project_name.snakeCase()}}/gen/assets.gen.dart'; -import 'package:{{project_name.snakeCase()}}/app/resources/app_colors.dart'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; void main() async { diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart index 450da5fb..a1bed477 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/test/app/screens/home/home_view_model_test.dart @@ -5,8 +5,8 @@ import 'package:{{project_name.snakeCase()}}/app/screens/home/home_view_model.da import 'package:{{project_name.snakeCase()}}/domain/usecases/base/base_use_case.dart'; import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; -import '../mocks/generate_mocks.mocks.dart'; -import '../mocks/data/remote/models/responses/user_response_mocks.dart'; +import '../../../mocks/generate_mocks.mocks.dart'; +import '../../../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group("HomeViewModelTest", () { From fd3e46fde56008dce103e38b97e9d1b4284f5ba9 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Fri, 25 Aug 2023 10:35:20 +0700 Subject: [PATCH 22/53] [#258] Rename my home screen test --- .../{my_home_page_test.dart => screens/home_screen_test.dart} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/{my_home_page_test.dart => screens/home_screen_test.dart} (95%) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/screens/home_screen_test.dart similarity index 95% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/screens/home_screen_test.dart index d26d2064..ecbef77b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/my_home_page_test.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/integration_test/screens/home_screen_test.dart @@ -3,7 +3,7 @@ import 'package:{{project_name.snakeCase()}}/app/screens/home/home_screen.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'utils/test_util.dart'; +import '../utils/test_util.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); From 223652cfbf9a07935f6167cb07d8037559ee84aa Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Fri, 25 Aug 2023 03:41:36 +0000 Subject: [PATCH 23/53] [Chore] Generate & update sample project --- .../home_screen_test.dart} | 4 +- sample/integration_test/utils/test_util.dart | 2 +- .../lib/{ => app}/resources/app_colors.dart | 0 sample/lib/app/screens/home/home_screen.dart | 83 +++++++++++++++++++ .../screens/home}/home_view_model.dart | 8 +- .../screens/home}/home_view_state.dart | 0 .../remote/datasources}/api_service.dart | 0 .../models/responses}/user_response.dart | 6 ++ .../credential_repository_impl.dart} | 11 +-- .../exceptions}/network_exceptions.dart | 0 sample/lib/{model => domain/models}/user.dart | 8 -- .../repositories/credential_repository.dart | 5 ++ .../usecases/base/base_use_case.dart | 0 .../usecases/base/use_case_result.dart | 0 .../usecases}/get_users_use_case.dart | 6 +- sample/lib/main.dart | 79 +----------------- .../screens/home}/home_view_model_test.dart | 13 ++- .../credential_repository_test.dart | 3 +- .../usecases}/get_users_use_case_test.dart | 7 +- .../responses}/user_response_mocks.dart | 0 sample/test/mocks/generate_mocks.dart | 4 +- 21 files changed, 123 insertions(+), 116 deletions(-) rename sample/integration_test/{my_home_page_test.dart => screens/home_screen_test.dart} (86%) rename sample/lib/{ => app}/resources/app_colors.dart (100%) create mode 100644 sample/lib/app/screens/home/home_screen.dart rename sample/lib/{ => app/screens/home}/home_view_model.dart (71%) rename sample/lib/{ => app/screens/home}/home_view_state.dart (100%) rename sample/lib/{api => data/remote/datasources}/api_service.dart (100%) rename sample/lib/{api/response => data/remote/models/responses}/user_response.dart (74%) rename sample/lib/{api/repository/credential_repository.dart => data/repositories/credential_repository_impl.dart} (67%) rename sample/lib/{api/exception => domain/exceptions}/network_exceptions.dart (100%) rename sample/lib/{model => domain/models}/user.dart (59%) create mode 100644 sample/lib/domain/repositories/credential_repository.dart rename sample/lib/{ => domain}/usecases/base/base_use_case.dart (100%) rename sample/lib/{ => domain}/usecases/base/use_case_result.dart (100%) rename sample/lib/{usecases/user => domain/usecases}/get_users_use_case.dart (76%) rename sample/test/{viewmodel => app/screens/home}/home_view_model_test.dart (73%) rename sample/test/{api/repository => data/repositories}/credential_repository_test.dart (89%) rename sample/test/{usecases/user => domain/usecases}/get_users_use_case_test.dart (77%) rename sample/test/mocks/{response => data/remote/models/responses}/user_response_mocks.dart (100%) diff --git a/sample/integration_test/my_home_page_test.dart b/sample/integration_test/screens/home_screen_test.dart similarity index 86% rename from sample/integration_test/my_home_page_test.dart rename to sample/integration_test/screens/home_screen_test.dart index 146a0f7f..a0fdc420 100644 --- a/sample/integration_test/my_home_page_test.dart +++ b/sample/integration_test/screens/home_screen_test.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:sample/main.dart'; +import 'package:sample/app/screens/home/home_screen.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'utils/test_util.dart'; +import '../utils/test_util.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); diff --git a/sample/integration_test/utils/test_util.dart b/sample/integration_test/utils/test_util.dart index 490f84a5..fde99a09 100644 --- a/sample/integration_test/utils/test_util.dart +++ b/sample/integration_test/utils/test_util.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_config/flutter_config.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:sample/main.dart'; import 'package:package_info_plus/package_info_plus.dart'; +import 'package:sample/main.dart'; class TestUtil { /// This is useful when we test the whole app with the real configs(styling, diff --git a/sample/lib/resources/app_colors.dart b/sample/lib/app/resources/app_colors.dart similarity index 100% rename from sample/lib/resources/app_colors.dart rename to sample/lib/app/resources/app_colors.dart diff --git a/sample/lib/app/screens/home/home_screen.dart b/sample/lib/app/screens/home/home_screen.dart new file mode 100644 index 00000000..5249a1e0 --- /dev/null +++ b/sample/lib/app/screens/home/home_screen.dart @@ -0,0 +1,83 @@ +import 'package:sample/app/screens/home/home_view_model.dart'; +import 'package:sample/app/screens/home/home_view_state.dart'; +import 'package:sample/domain/usecases/get_users_use_case.dart'; +import 'package:sample/main.dart'; +import 'package:sample/di/di.dart'; +import 'package:sample/gen/assets.gen.dart'; +import 'package:sample/app/resources/app_colors.dart'; +import 'package:package_info_plus/package_info_plus.dart'; +import 'package:flutter_config/flutter_config.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:go_router/go_router.dart'; + +final homeViewModelProvider = + StateNotifierProvider.autoDispose((ref) { + return HomeViewModel( + getIt.get(), + ); +}); + +class HomeScreen extends ConsumerStatefulWidget { + const HomeScreen({super.key}); + + @override + ConsumerState createState() => _HomeScreenState(); +} + +class _HomeScreenState extends ConsumerState { + @override + void initState() { + super.initState(); + ref.read(homeViewModelProvider.notifier).getUsers(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: FutureBuilder( + future: PackageInfo.fromPlatform(), + builder: (context, snapshot) { + return snapshot.hasData + ? Text(snapshot.data?.appName ?? "") + : const SizedBox.shrink(); + }), + ), + body: Center( + child: Column( + children: [ + const SizedBox(height: 24), + FractionallySizedBox( + widthFactor: 0.5, + child: Image.asset( + Assets.images.nimbleLogo.path, + fit: BoxFit.fitWidth, + ), + ), + const SizedBox(height: 8), + Assets.svg.flutterLogo.svg( + width: 32, + height: 32, + ), + const SizedBox(height: 24), + Text(AppLocalizations.of(context)!.hello), + Text( + FlutterConfig.get('SECRET'), + style: const TextStyle( + color: AppColors.nimblePrimaryBlue, + fontSize: 24, + ), + ), + const SizedBox(height: 24), + ElevatedButton( + onPressed: () => context.go('/$routePathSecondScreen'), + child: const Text("Navigate to Second Screen"), + ), + ], + ), + ), + ); + } +} diff --git a/sample/lib/home_view_model.dart b/sample/lib/app/screens/home/home_view_model.dart similarity index 71% rename from sample/lib/home_view_model.dart rename to sample/lib/app/screens/home/home_view_model.dart index 8b05b50d..ce1efff9 100644 --- a/sample/lib/home_view_model.dart +++ b/sample/lib/app/screens/home/home_view_model.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'package:sample/home_view_state.dart'; -import 'package:sample/usecases/base/base_use_case.dart'; -import 'package:sample/usecases/user/get_users_use_case.dart'; -import 'package:sample/model/user.dart'; +import 'package:sample/app/screens/home/home_view_state.dart'; +import 'package:sample/domain/usecases/base/base_use_case.dart'; +import 'package:sample/domain/usecases/get_users_use_case.dart'; +import 'package:sample/domain/models/user.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; class HomeViewModel extends StateNotifier { diff --git a/sample/lib/home_view_state.dart b/sample/lib/app/screens/home/home_view_state.dart similarity index 100% rename from sample/lib/home_view_state.dart rename to sample/lib/app/screens/home/home_view_state.dart diff --git a/sample/lib/api/api_service.dart b/sample/lib/data/remote/datasources/api_service.dart similarity index 100% rename from sample/lib/api/api_service.dart rename to sample/lib/data/remote/datasources/api_service.dart diff --git a/sample/lib/api/response/user_response.dart b/sample/lib/data/remote/models/responses/user_response.dart similarity index 74% rename from sample/lib/api/response/user_response.dart rename to sample/lib/data/remote/models/responses/user_response.dart index 6e95125c..43fc3569 100644 --- a/sample/lib/api/response/user_response.dart +++ b/sample/lib/data/remote/models/responses/user_response.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:sample/domain/models/user.dart'; part 'user_response.g.dart'; @@ -13,4 +14,9 @@ class UserResponse { _$UserResponseFromJson(json); Map toJson() => _$UserResponseToJson(this); + + User toUser() => User( + email: email, + username: username, + ); } diff --git a/sample/lib/api/repository/credential_repository.dart b/sample/lib/data/repositories/credential_repository_impl.dart similarity index 67% rename from sample/lib/api/repository/credential_repository.dart rename to sample/lib/data/repositories/credential_repository_impl.dart index 8d3cf711..42517e33 100644 --- a/sample/lib/api/repository/credential_repository.dart +++ b/sample/lib/data/repositories/credential_repository_impl.dart @@ -1,12 +1,9 @@ import 'package:sample/data/remote/datasources/api_service.dart'; -import 'package:{{project_name.snakeCase()}}/domain/exceptions/network_exceptions.dart'; -import 'package:sample/model/user.dart'; +import 'package:sample/domain/exceptions/network_exceptions.dart'; +import 'package:sample/domain/models/user.dart'; +import 'package:sample/domain/repositories/credential_repository.dart'; import 'package:injectable/injectable.dart'; -abstract class CredentialRepository { - Future> getUsers(); -} - @LazySingleton(as: CredentialRepository) class CredentialRepositoryImpl extends CredentialRepository { final BaseApiService _apiService; @@ -18,7 +15,7 @@ class CredentialRepositoryImpl extends CredentialRepository { try { final userResponses = await _apiService.getUsers(); return userResponses - .map((userResponse) => User.fromUserResponse(userResponse)) + .map((userResponse) => userResponse.toUser()) .toList(); } catch (exception) { throw NetworkExceptions.fromDioException(exception); diff --git a/sample/lib/api/exception/network_exceptions.dart b/sample/lib/domain/exceptions/network_exceptions.dart similarity index 100% rename from sample/lib/api/exception/network_exceptions.dart rename to sample/lib/domain/exceptions/network_exceptions.dart diff --git a/sample/lib/model/user.dart b/sample/lib/domain/models/user.dart similarity index 59% rename from sample/lib/model/user.dart rename to sample/lib/domain/models/user.dart index e1c85d39..f79c2ad7 100644 --- a/sample/lib/model/user.dart +++ b/sample/lib/domain/models/user.dart @@ -1,5 +1,4 @@ import 'package:equatable/equatable.dart'; -import 'package:sample/data/remote/models/responses/user_response.dart'; class User extends Equatable { final String email; @@ -10,13 +9,6 @@ class User extends Equatable { required this.username, }); - factory User.fromUserResponse(UserResponse response) { - return User( - email: response.email, - username: response.username, - ); - } - @override bool? get stringify => true; diff --git a/sample/lib/domain/repositories/credential_repository.dart b/sample/lib/domain/repositories/credential_repository.dart new file mode 100644 index 00000000..2c42f7d9 --- /dev/null +++ b/sample/lib/domain/repositories/credential_repository.dart @@ -0,0 +1,5 @@ +import 'package:sample/domain/models/user.dart'; + +abstract class CredentialRepository { + Future> getUsers(); +} diff --git a/sample/lib/usecases/base/base_use_case.dart b/sample/lib/domain/usecases/base/base_use_case.dart similarity index 100% rename from sample/lib/usecases/base/base_use_case.dart rename to sample/lib/domain/usecases/base/base_use_case.dart diff --git a/sample/lib/usecases/base/use_case_result.dart b/sample/lib/domain/usecases/base/use_case_result.dart similarity index 100% rename from sample/lib/usecases/base/use_case_result.dart rename to sample/lib/domain/usecases/base/use_case_result.dart diff --git a/sample/lib/usecases/user/get_users_use_case.dart b/sample/lib/domain/usecases/get_users_use_case.dart similarity index 76% rename from sample/lib/usecases/user/get_users_use_case.dart rename to sample/lib/domain/usecases/get_users_use_case.dart index 296fbb6b..20ad879e 100644 --- a/sample/lib/usecases/user/get_users_use_case.dart +++ b/sample/lib/domain/usecases/get_users_use_case.dart @@ -1,7 +1,7 @@ import 'package:sample/domain/exceptions/network_exceptions.dart'; -import 'package:sample/api/repository/credential_repository.dart'; -import 'package:sample/usecases/base/base_use_case.dart'; -import 'package:sample/model/user.dart'; +import 'package:sample/domain/repositories/credential_repository.dart'; +import 'package:sample/domain/usecases/base/base_use_case.dart'; +import 'package:sample/domain/models/user.dart'; import 'package:injectable/injectable.dart'; @Injectable() diff --git a/sample/lib/main.dart b/sample/lib/main.dart index 3b14fac4..c4835bd5 100644 --- a/sample/lib/main.dart +++ b/sample/lib/main.dart @@ -1,16 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:flutter_config/flutter_config.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; -import 'package:package_info_plus/package_info_plus.dart'; +import 'package:flutter_config/flutter_config.dart'; import 'package:sample/di/di.dart'; import 'package:sample/gen/assets.gen.dart'; -import 'package:sample/resources/app_colors.dart'; -import 'package:sample/usecases/user/get_users_use_case.dart'; - -import 'home_view_model.dart'; -import 'home_view_state.dart'; +import 'package:sample/app/screens/home/home_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -63,76 +58,6 @@ class MyApp extends StatelessWidget { } } -final homeViewModelProvider = - StateNotifierProvider.autoDispose((ref) { - return HomeViewModel( - getIt.get(), - ); -}); - -class HomeScreen extends ConsumerStatefulWidget { - const HomeScreen({super.key}); - - @override - HomeScreenState createState() => HomeScreenState(); -} - -class HomeScreenState extends ConsumerState { - @override - void initState() { - super.initState(); - ref.read(homeViewModelProvider.notifier).getUsers(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: FutureBuilder( - future: PackageInfo.fromPlatform(), - builder: (context, snapshot) { - return snapshot.hasData - ? Text(snapshot.data?.appName ?? "") - : const SizedBox.shrink(); - }), - ), - body: Center( - child: Column( - children: [ - const SizedBox(height: 24), - FractionallySizedBox( - widthFactor: 0.5, - child: Image.asset( - Assets.images.nimbleLogo.path, - fit: BoxFit.fitWidth, - ), - ), - const SizedBox(height: 8), - Assets.svg.flutterLogo.svg( - width: 32, - height: 32, - ), - const SizedBox(height: 24), - Text(AppLocalizations.of(context)!.hello), - Text( - FlutterConfig.get('SECRET'), - style: const TextStyle( - color: AppColors.nimblePrimaryBlue, - fontSize: 24, - ), - ), - const SizedBox(height: 24), - ElevatedButton( - onPressed: () => context.go('/$routePathSecondScreen'), - child: const Text("Navigate to Second Screen"), - ), - ], - ), - ), - ); - } -} - class SecondScreen extends StatelessWidget { const SecondScreen({ Key? key, diff --git a/sample/test/viewmodel/home_view_model_test.dart b/sample/test/app/screens/home/home_view_model_test.dart similarity index 73% rename from sample/test/viewmodel/home_view_model_test.dart rename to sample/test/app/screens/home/home_view_model_test.dart index 99089802..8aa3b5bb 100644 --- a/sample/test/viewmodel/home_view_model_test.dart +++ b/sample/test/app/screens/home/home_view_model_test.dart @@ -1,13 +1,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; -import 'package:sample/usecases/base/base_use_case.dart'; -import 'package:sample/home_view_model.dart'; -import 'package:sample/main.dart'; -import 'package:sample/model/user.dart'; +import 'package:sample/app/screens/home/home_view_model.dart'; +import 'package:sample/domain/usecases/base/base_use_case.dart'; +import 'package:sample/app/screens/home/home_screen.dart'; -import '../mocks/generate_mocks.mocks.dart'; -import '../mocks/data/remote/models/responses/user_response_mocks.dart'; +import '../../../mocks/generate_mocks.mocks.dart'; +import '../../../mocks/data/remote/models/responses/user_response_mocks.dart'; void main() { group("HomeViewModelTest", () { @@ -30,7 +29,7 @@ void main() { test('When calling get user list successfully, it returns correctly', () async { - final expectedResult = [User.fromUserResponse(UserResponseMocks.mock())]; + final expectedResult = [UserResponseMocks.mock().toUser()]; when(mockGetUsersUseCase.call()) .thenAnswer((_) async => Success(expectedResult)); diff --git a/sample/test/api/repository/credential_repository_test.dart b/sample/test/data/repositories/credential_repository_test.dart similarity index 89% rename from sample/test/api/repository/credential_repository_test.dart rename to sample/test/data/repositories/credential_repository_test.dart index f6619ee5..447afd70 100644 --- a/sample/test/api/repository/credential_repository_test.dart +++ b/sample/test/data/repositories/credential_repository_test.dart @@ -1,5 +1,6 @@ import 'package:sample/domain/exceptions/network_exceptions.dart'; -import 'package:sample/api/repository/credential_repository.dart'; +import 'package:sample/domain/repositories/credential_repository.dart'; +import 'package:sample/data/repositories/credential_repository_impl.dart'; import 'package:sample/data/remote/models/responses/user_response.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/sample/test/usecases/user/get_users_use_case_test.dart b/sample/test/domain/usecases/get_users_use_case_test.dart similarity index 77% rename from sample/test/usecases/user/get_users_use_case_test.dart rename to sample/test/domain/usecases/get_users_use_case_test.dart index aab8fb84..34840741 100644 --- a/sample/test/usecases/user/get_users_use_case_test.dart +++ b/sample/test/domain/usecases/get_users_use_case_test.dart @@ -1,8 +1,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; -import 'package:sample/usecases/base/base_use_case.dart'; -import 'package:sample/usecases/user/get_users_use_case.dart'; -import 'package:sample/model/user.dart'; +import 'package:sample/domain/usecases/base/base_use_case.dart'; +import 'package:sample/domain/usecases/get_users_use_case.dart'; import '../../mocks/generate_mocks.mocks.dart'; import '../../mocks/data/remote/models/responses/user_response_mocks.dart'; @@ -19,7 +18,7 @@ void main() { test('When getting users successfully, it returns Success result', () async { - final expectedResult = [User.fromUserResponse(UserResponseMocks.mock())]; + final expectedResult = [UserResponseMocks.mock().toUser()]; when(mockRepository.getUsers()).thenAnswer((_) async => expectedResult); final result = await getUsersUseCase.call(); diff --git a/sample/test/mocks/response/user_response_mocks.dart b/sample/test/mocks/data/remote/models/responses/user_response_mocks.dart similarity index 100% rename from sample/test/mocks/response/user_response_mocks.dart rename to sample/test/mocks/data/remote/models/responses/user_response_mocks.dart diff --git a/sample/test/mocks/generate_mocks.dart b/sample/test/mocks/generate_mocks.dart index 87d9bb7e..00efbe72 100644 --- a/sample/test/mocks/generate_mocks.dart +++ b/sample/test/mocks/generate_mocks.dart @@ -1,7 +1,7 @@ import 'package:dio/dio.dart'; import 'package:sample/data/remote/datasources/api_service.dart'; -import 'package:sample/api/repository/credential_repository.dart'; -import 'package:sample/usecases/user/get_users_use_case.dart'; +import 'package:sample/domain/repositories/credential_repository.dart'; +import 'package:sample/domain/usecases/get_users_use_case.dart'; import 'package:mockito/annotations.dart'; @GenerateMocks([ From dbfa1547c5106f0be94dde0c22bcad64856a51e7 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Mon, 28 Aug 2023 15:29:01 +0700 Subject: [PATCH 24/53] [#258] Add .keep file at models/requests --- .../lib/data/remote/models/requests/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/models/requests/.keep diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/models/requests/.keep b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/remote/models/requests/.keep new file mode 100644 index 00000000..e69de29b From 4832e582b06b9689348827d02f61bdd825cffd31 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Mon, 28 Aug 2023 08:35:41 +0000 Subject: [PATCH 25/53] [Chore] Generate & update sample project --- sample/lib/data/remote/models/requests/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sample/lib/data/remote/models/requests/.keep diff --git a/sample/lib/data/remote/models/requests/.keep b/sample/lib/data/remote/models/requests/.keep new file mode 100644 index 00000000..e69de29b From 6502dd52f7a0518b76a59487fa2be54309137ea1 Mon Sep 17 00:00:00 2001 From: Tam Nguyen Minh Date: Mon, 31 Jul 2023 16:09:19 +0700 Subject: [PATCH 26/53] [234] Add flutter_secure_storage library --- .../lib/di/module/storage_module.dart | 9 ++++++ .../lib/storage/secure_storage.dart | 32 +++++++++++++++++++ .../{{project_name.snakeCase()}}/pubspec.yaml | 1 + 3 files changed, 42 insertions(+) create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/storage_module.dart create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/storage_module.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/storage_module.dart new file mode 100644 index 00000000..2c62781a --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/di/module/storage_module.dart @@ -0,0 +1,9 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:injectable/injectable.dart'; + +@module +abstract class StorageModule { + @singleton + FlutterSecureStorage get flutterSecureStorage => const FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true)); +} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart new file mode 100644 index 00000000..366aba13 --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart @@ -0,0 +1,32 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:injectable/injectable.dart'; + +const _keyAccessToken = 'KEY_ACCESS_TOKEN'; + +abstract class SecureStorage { + Future get accessToken; + + Future storeAccessToken(String accessToken); + + Future clearAllStorage(); +} + +@Singleton(as: SecureStorage) +class SecureStorageImpl extends SecureStorage { + final FlutterSecureStorage _storage; + + SecureStorageImpl(this._storage); + + @override + Future get accessToken => _storage.read(key: _keyAccessToken); + + @override + Future storeAccessToken(String accessToken) { + return _storage.write(key: _keyAccessToken, value: accessToken); + } + + @override + Future clearAllStorage() { + return _storage.deleteAll(); + } +} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index dbc274e7..366af096 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: json_annotation: ^4.8.1 package_info_plus: ^4.0.0{{#add_permission_handler}}{{{ _pubspec_dependencyyaml }}}{{/add_permission_handler}} retrofit: ^4.0.1 + flutter_secure_storage: ^8.0.0 dev_dependencies: build_runner: ^2.4.4 From 96dfa0bfcd9d7cb1b0eae182dac9abcdeed89ac8 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Tue, 22 Aug 2023 02:43:09 +0000 Subject: [PATCH 27/53] [Chore] Generate & update sample project --- sample/lib/di/module/storage_module.dart | 9 +++++++ sample/lib/storage/secure_storage.dart | 32 ++++++++++++++++++++++++ sample/pubspec.yaml | 1 + 3 files changed, 42 insertions(+) create mode 100644 sample/lib/di/module/storage_module.dart create mode 100644 sample/lib/storage/secure_storage.dart diff --git a/sample/lib/di/module/storage_module.dart b/sample/lib/di/module/storage_module.dart new file mode 100644 index 00000000..2c62781a --- /dev/null +++ b/sample/lib/di/module/storage_module.dart @@ -0,0 +1,9 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:injectable/injectable.dart'; + +@module +abstract class StorageModule { + @singleton + FlutterSecureStorage get flutterSecureStorage => const FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true)); +} diff --git a/sample/lib/storage/secure_storage.dart b/sample/lib/storage/secure_storage.dart new file mode 100644 index 00000000..366aba13 --- /dev/null +++ b/sample/lib/storage/secure_storage.dart @@ -0,0 +1,32 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:injectable/injectable.dart'; + +const _keyAccessToken = 'KEY_ACCESS_TOKEN'; + +abstract class SecureStorage { + Future get accessToken; + + Future storeAccessToken(String accessToken); + + Future clearAllStorage(); +} + +@Singleton(as: SecureStorage) +class SecureStorageImpl extends SecureStorage { + final FlutterSecureStorage _storage; + + SecureStorageImpl(this._storage); + + @override + Future get accessToken => _storage.read(key: _keyAccessToken); + + @override + Future storeAccessToken(String accessToken) { + return _storage.write(key: _keyAccessToken, value: accessToken); + } + + @override + Future clearAllStorage() { + return _storage.deleteAll(); + } +} diff --git a/sample/pubspec.yaml b/sample/pubspec.yaml index 406a08b5..615604a0 100644 --- a/sample/pubspec.yaml +++ b/sample/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: package_info_plus: ^4.0.0 permission_handler: ^10.2.0 retrofit: ^4.0.1 + flutter_secure_storage: ^8.0.0 dev_dependencies: build_runner: ^2.4.4 From 67bd37fb7942044948ce66b02bfb2d5ec6bcee48 Mon Sep 17 00:00:00 2001 From: Tam Nguyen Minh Date: Thu, 31 Aug 2023 15:11:23 +0700 Subject: [PATCH 28/53] [234] Add flutter_secure_storage library --- README.md | 1 + .../local}/secure_storage.dart | 4 +- .../{{project_name.snakeCase()}}/pubspec.yaml | 2 +- sample/lib/storage/secure_storage.dart | 4 +- sample/pubspec.lock | 128 ++++++++++++++++-- sample/pubspec.yaml | 2 +- 6 files changed, 127 insertions(+), 14 deletions(-) rename bricks/template/__brick__/{{project_name.snakeCase()}}/lib/{storage => data/local}/secure_storage.dart (91%) diff --git a/README.md b/README.md index f0eb454a..409ec897 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ All the templates can be used to kick off a new Flutter project quickly. - [Pre-set environments](bricks/template/__brick__/%7B%7Bproject_name.snakeCase()%7D%7D#setup): `Staging` and `Production`. Environment variables are supplied through `.env` files through [flutter_config](https://pub.dev/packages/flutter_config). - Dependency Injection (DI), State Management, and Navigating with [get_it](https://pub.dev/packages/get_it), [flutter_riverpod](https://pub.dev/packages/flutter_riverpod), and [go_router](https://pub.dev/packages/go_router). - Networking with [dio](https://pub.dev/packages/dio) and [retrofit](https://pub.dev/packages/retrofit), JSON serializing with [json_serializable](https://pub.dev/packages/json_serializable). +- Integrated local [secure storage](https://pub.dev/packages/flutter_secure_storage). - [Localization](https://docs.flutter.dev/accessibility-and-localization/internationalization) integrated in [3 initial languages](bricks/template/__brick__/%7B%7Bproject_name.snakeCase()%7D%7D/lib/l10n). - [Testing](https://docs.flutter.dev/testing)-ready (unit, integration, and widget testing), [production and deployment](https://docs.flutter.dev/deployment)-ready (to Firebase, Play Store, TestFlight, and AppStore). - Built-in [GitHub templates & CI/CD workflows](bricks/template/__brick__/%7B%7Bproject_name.snakeCase()%7D%7D/.github) integrated with GitHub Actions to perform static code analysis, test, build and deploy app builds to app distribution services or app stores. diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/local/secure_storage.dart similarity index 91% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart rename to bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/local/secure_storage.dart index 366aba13..d06b5059 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/storage/secure_storage.dart +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/lib/data/local/secure_storage.dart @@ -8,7 +8,7 @@ abstract class SecureStorage { Future storeAccessToken(String accessToken); - Future clearAllStorage(); + Future clearAll(); } @Singleton(as: SecureStorage) @@ -26,7 +26,7 @@ class SecureStorageImpl extends SecureStorage { } @override - Future clearAllStorage() { + Future clearAll() { return _storage.deleteAll(); } } diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 366af096..e6558280 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: flutter_localizations: sdk: flutter flutter_riverpod: ^2.3.6 + flutter_secure_storage: ^9.0.0 flutter_svg: ^2.0.7 freezed_annotation: ^2.2.0 get_it: ^7.6.0 @@ -45,7 +46,6 @@ dependencies: json_annotation: ^4.8.1 package_info_plus: ^4.0.0{{#add_permission_handler}}{{{ _pubspec_dependencyyaml }}}{{/add_permission_handler}} retrofit: ^4.0.1 - flutter_secure_storage: ^8.0.0 dev_dependencies: build_runner: ^2.4.4 diff --git a/sample/lib/storage/secure_storage.dart b/sample/lib/storage/secure_storage.dart index 366aba13..d06b5059 100644 --- a/sample/lib/storage/secure_storage.dart +++ b/sample/lib/storage/secure_storage.dart @@ -8,7 +8,7 @@ abstract class SecureStorage { Future storeAccessToken(String accessToken); - Future clearAllStorage(); + Future clearAll(); } @Singleton(as: SecureStorage) @@ -26,7 +26,7 @@ class SecureStorageImpl extends SecureStorage { } @override - Future clearAllStorage() { + Future clearAll() { return _storage.deleteAll(); } } diff --git a/sample/pubspec.lock b/sample/pubspec.lock index afe8f03c..45910df8 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -193,6 +193,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.2" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" fake_async: dependency: transitive description: @@ -272,14 +280,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_svg: - dependency: "direct main" - description: - name: flutter_svg - sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338" - url: "https://pub.dev" - source: hosted - version: "2.0.7" flutter_riverpod: dependency: "direct main" description: @@ -288,6 +288,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.6" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "22dbf16f23a4bcf9d35e51be1c84ad5bb6f627750565edd70dab70f3ff5fff8f" + url: "https://pub.dev" + source: hosted + version: "8.1.0" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c + url: "https://pub.dev" + source: hosted + version: "3.0.1" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: "38f9501c7cb6f38961ef0e1eacacee2b2d4715c63cc83fe56449c4d3d0b47255" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338" + url: "https://pub.dev" + source: hosted + version: "2.0.7" flutter_test: dependency: "direct dev" description: flutter @@ -391,6 +447,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + injectable_generator: + dependency: "direct dev" + description: + name: injectable_generator + sha256: "4fe3db041b680098ce3af40b680734906e955a0ce89170d3993626d48d27b2f3" + url: "https://pub.dev" + source: hosted + version: "2.1.6" integration_test: dependency: "direct dev" description: flutter @@ -532,6 +596,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81" + url: "https://pub.dev" + source: hosted + version: "10.4.3" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: d74e77a5ecd38649905db0a7d05ef16bed42ff263b9efb73ed794317c5764ec3 + url: "https://pub.dev" + source: hosted + version: "10.3.4" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" + url: "https://pub.dev" + source: hosted + version: "9.1.4" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9" + url: "https://pub.dev" + source: hosted + version: "3.11.3" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 + url: "https://pub.dev" + source: hosted + version: "0.1.3" petitparser: dependency: transitive description: @@ -588,6 +692,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" retrofit: dependency: "direct main" description: diff --git a/sample/pubspec.yaml b/sample/pubspec.yaml index 615604a0..83c41f5b 100644 --- a/sample/pubspec.yaml +++ b/sample/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: flutter_localizations: sdk: flutter flutter_riverpod: ^2.3.6 + flutter_secure_storage: ^8.0.0 flutter_svg: ^2.0.7 freezed_annotation: ^2.2.0 get_it: ^7.6.0 @@ -46,7 +47,6 @@ dependencies: package_info_plus: ^4.0.0 permission_handler: ^10.2.0 retrofit: ^4.0.1 - flutter_secure_storage: ^8.0.0 dev_dependencies: build_runner: ^2.4.4 From e039988de617ddfc7f39214ecf0989e1c0b27d5e Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Thu, 31 Aug 2023 08:17:00 +0000 Subject: [PATCH 29/53] [Chore] Generate & update sample project --- .../workflows/android_deploy_production.yml | 7 +- ...android_deploy_production_to_playstore.yml | 9 +- .../workflows/android_deploy_staging.yml | 7 +- sample/.github/workflows/bump_version.yml | 2 - .../ios_deploy_staging_to_firebase.yml | 7 +- .../workflows/ios_deploy_to_app_store.yml | 1 + .../workflows/ios_deploy_to_testflight.yml | 1 + sample/ios/fastlane/Constants/Environments.rb | 4 +- sample/ios/fastlane/Fastfile | 2 +- .../local}/secure_storage.dart | 0 sample/pubspec.lock | 128 ++---------------- sample/pubspec.yaml | 2 +- 12 files changed, 31 insertions(+), 139 deletions(-) rename sample/lib/{storage => data/local}/secure_storage.dart (100%) diff --git a/sample/.github/workflows/android_deploy_production.yml b/sample/.github/workflows/android_deploy_production.yml index e83bd7b2..0fe0d6b9 100644 --- a/sample/.github/workflows/android_deploy_production.yml +++ b/sample/.github/workflows/android_deploy_production.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -34,9 +35,9 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -45,7 +46,7 @@ jobs: - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_PRODUCTION }} + appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} file: build/app/outputs/flutter-apk/app-production-debug.apk diff --git a/sample/.github/workflows/android_deploy_production_to_playstore.yml b/sample/.github/workflows/android_deploy_production_to_playstore.yml index 077e497a..0a18534e 100644 --- a/sample/.github/workflows/android_deploy_production_to_playstore.yml +++ b/sample/.github/workflows/android_deploy_production_to_playstore.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: production timeout-minutes: 30 steps: - name: Check out @@ -34,17 +35,17 @@ jobs: - name: Set up .env env: - ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_PRODUCTION > .env + echo "$ENV" > .env - name: Set up release signing configs env: ANDROID_RELEASE_KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }} - ANDROID_SIGNING_PROPERTIES_BASE64: ${{ secrets.ANDROID_SIGNING_PROPERTIES_BASE64 }} + ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }} run: | echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore - echo $ANDROID_SIGNING_PROPERTIES_BASE64 | base64 --decode > android/signing.properties + echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties - name: Build Production App Bundle run: flutter build appbundle --flavor production --release --build-number $GITHUB_RUN_NUMBER diff --git a/sample/.github/workflows/android_deploy_staging.yml b/sample/.github/workflows/android_deploy_staging.yml index 97f4385b..351f3792 100644 --- a/sample/.github/workflows/android_deploy_staging.yml +++ b/sample/.github/workflows/android_deploy_staging.yml @@ -9,6 +9,7 @@ jobs: build_and_deploy_android: name: Build & Deploy Android runs-on: ubuntu-latest + environment: staging timeout-minutes: 30 steps: - name: Check out @@ -34,9 +35,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{ secrets.ENV_STAGING }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk @@ -45,7 +46,7 @@ jobs: - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: - appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_STAGING }} + appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/sample/.github/workflows/bump_version.yml b/sample/.github/workflows/bump_version.yml index b08316d3..a2ade5ac 100644 --- a/sample/.github/workflows/bump_version.yml +++ b/sample/.github/workflows/bump_version.yml @@ -16,8 +16,6 @@ jobs: steps: - name: Check out uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Set new version run: | diff --git a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml index 1793b944..3bc27e76 100644 --- a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_staging_app_to_firebase: name: Build And Upload iOS Staging Application To Firebase runs-on: macOS-latest + environment: staging env: TEAM_ID: ${{ secrets.TEAM_ID }} FASTLANE_USER: ${{ secrets.FASTLANE_USER }} @@ -18,7 +19,7 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} - FIREBASE_APP_ID_STAGING: ${{ secrets.FIREBASE_IOS_APP_ID_STAGING }} + FIREBASE_APP_ID: ${{ vars.FIREBASE_IOS_APP_ID }} FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: @@ -41,9 +42,9 @@ jobs: - name: Set up .env.staging env: - ENV_STAGING: ${{ secrets.ENV_STAGING }} + ENV: ${{ secrets.ENV }} run: | - echo $ENV_STAGING > .env.staging + echo "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index 697c53ac..7ceb4d03 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_app_store: name: Build And Upload iOS Application To AppStore runs-on: macOS-latest + environment: staging timeout-minutes: 30 env: TEAM_ID: ${{ secrets.TEAM_ID }} diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 0aa0cfec..6b25d87a 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_testflight: name: Build And Upload iOS Application To TestFlight runs-on: macOS-latest + environment: staging timeout-minutes: 30 env: TEAM_ID: ${{ secrets.TEAM_ID }} diff --git a/sample/ios/fastlane/Constants/Environments.rb b/sample/ios/fastlane/Constants/Environments.rb index 33ca0dfe..49c68679 100644 --- a/sample/ios/fastlane/Constants/Environments.rb +++ b/sample/ios/fastlane/Constants/Environments.rb @@ -23,8 +23,8 @@ def self.FIREBASE_CLI_TOKEN ENV['FIREBASE_CLI_TOKEN'] end - def self.FIREBASE_APP_ID_STAGING - ENV['FIREBASE_APP_ID_STAGING'] + def self.FIREBASE_APP_ID + ENV['FIREBASE_APP_ID'] end def self.FIREBASE_TESTER_GROUPS diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index f0520618..4d0c62ab 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -106,7 +106,7 @@ platform :ios do scheme_name: Constants.SCHEME_NAME_STAGING, product_name: Constants.PRODUCT_NAME_STAGING, bundle_id: Constants.BUNDLE_ID_STAGING, - app_id: Environments.FIREBASE_APP_ID_STAGING + app_id: Environments.FIREBASE_APP_ID ) end diff --git a/sample/lib/storage/secure_storage.dart b/sample/lib/data/local/secure_storage.dart similarity index 100% rename from sample/lib/storage/secure_storage.dart rename to sample/lib/data/local/secure_storage.dart diff --git a/sample/pubspec.lock b/sample/pubspec.lock index 45910df8..afe8f03c 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -193,14 +193,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.2" - equatable: - dependency: "direct main" - description: - name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.dev" - source: hosted - version: "2.0.5" fake_async: dependency: transitive description: @@ -280,62 +272,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_riverpod: - dependency: "direct main" - description: - name: flutter_riverpod - sha256: b83ac5827baadefd331ea1d85110f34645827ea234ccabf53a655f41901a9bf4 - url: "https://pub.dev" - source: hosted - version: "2.3.6" - flutter_secure_storage: - dependency: "direct main" - description: - name: flutter_secure_storage - sha256: "22dbf16f23a4bcf9d35e51be1c84ad5bb6f627750565edd70dab70f3ff5fff8f" - url: "https://pub.dev" - source: hosted - version: "8.1.0" - flutter_secure_storage_linux: - dependency: transitive - description: - name: flutter_secure_storage_linux - sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - flutter_secure_storage_macos: - dependency: transitive - description: - name: flutter_secure_storage_macos - sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c - url: "https://pub.dev" - source: hosted - version: "3.0.1" - flutter_secure_storage_platform_interface: - dependency: transitive - description: - name: flutter_secure_storage_platform_interface - sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - flutter_secure_storage_web: - dependency: transitive - description: - name: flutter_secure_storage_web - sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" - url: "https://pub.dev" - source: hosted - version: "1.1.2" - flutter_secure_storage_windows: - dependency: transitive - description: - name: flutter_secure_storage_windows - sha256: "38f9501c7cb6f38961ef0e1eacacee2b2d4715c63cc83fe56449c4d3d0b47255" - url: "https://pub.dev" - source: hosted - version: "2.1.1" flutter_svg: dependency: "direct main" description: @@ -344,6 +280,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.7" + flutter_riverpod: + dependency: "direct main" + description: + name: flutter_riverpod + sha256: b83ac5827baadefd331ea1d85110f34645827ea234ccabf53a655f41901a9bf4 + url: "https://pub.dev" + source: hosted + version: "2.3.6" flutter_test: dependency: "direct dev" description: flutter @@ -447,14 +391,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" - injectable_generator: - dependency: "direct dev" - description: - name: injectable_generator - sha256: "4fe3db041b680098ce3af40b680734906e955a0ce89170d3993626d48d27b2f3" - url: "https://pub.dev" - source: hosted - version: "2.1.6" integration_test: dependency: "direct dev" description: flutter @@ -596,46 +532,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - permission_handler: - dependency: "direct main" - description: - name: permission_handler - sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81" - url: "https://pub.dev" - source: hosted - version: "10.4.3" - permission_handler_android: - dependency: transitive - description: - name: permission_handler_android - sha256: d74e77a5ecd38649905db0a7d05ef16bed42ff263b9efb73ed794317c5764ec3 - url: "https://pub.dev" - source: hosted - version: "10.3.4" - permission_handler_apple: - dependency: transitive - description: - name: permission_handler_apple - sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" - url: "https://pub.dev" - source: hosted - version: "9.1.4" - permission_handler_platform_interface: - dependency: transitive - description: - name: permission_handler_platform_interface - sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9" - url: "https://pub.dev" - source: hosted - version: "3.11.3" - permission_handler_windows: - dependency: transitive - description: - name: permission_handler_windows - sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 - url: "https://pub.dev" - source: hosted - version: "0.1.3" petitparser: dependency: transitive description: @@ -692,14 +588,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" retrofit: dependency: "direct main" description: diff --git a/sample/pubspec.yaml b/sample/pubspec.yaml index 83c41f5b..22e174ba 100644 --- a/sample/pubspec.yaml +++ b/sample/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: flutter_localizations: sdk: flutter flutter_riverpod: ^2.3.6 - flutter_secure_storage: ^8.0.0 + flutter_secure_storage: ^9.0.0 flutter_svg: ^2.0.7 freezed_annotation: ^2.2.0 get_it: ^7.6.0 From 5828298a7067baf151a5b20451ee24bb15c80b37 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Mon, 7 Aug 2023 11:43:29 +0700 Subject: [PATCH 30/53] [#169] Implement upload to testflight and app store flow --- .../ios_deploy_production_to_app_store.yml | 97 +++++++++++++++++++ .../ios_deploy_production_to_testflight.yml | 97 +++++++++++++++++++ bricks/template/.idea/vcs.xml | 6 ++ .../ios_deploy_production_to_app_store.yml | 88 +++++++++++++++++ .../ios_deploy_production_to_testflight.yml | 88 +++++++++++++++++ .../workflows/ios_deploy_to_app_store.yml | 55 ----------- .../workflows/ios_deploy_to_testflight.yml | 55 ----------- .../ios/fastlane/Constants/Environments.rb | 12 +++ .../ios/fastlane/Fastfile | 61 +++++++++++- .../ios_deploy_production_to_app_store.yml | 97 +++++++++++++++++++ .../ios_deploy_production_to_testflight.yml | 97 +++++++++++++++++++ .../workflows/ios_deploy_to_app_store.yml | 55 ----------- .../workflows/ios_deploy_to_testflight.yml | 55 ----------- sample/ios/fastlane/Constants/Environments.rb | 12 +++ sample/ios/fastlane/Fastfile | 37 +++++++ 15 files changed, 691 insertions(+), 221 deletions(-) create mode 100644 .github/workflows/ios_deploy_production_to_app_store.yml create mode 100644 .github/workflows/ios_deploy_production_to_testflight.yml create mode 100644 bricks/template/.idea/vcs.xml create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml create mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml delete mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml delete mode 100644 bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml create mode 100644 sample/.github/workflows/ios_deploy_production_to_app_store.yml create mode 100644 sample/.github/workflows/ios_deploy_production_to_testflight.yml delete mode 100644 sample/.github/workflows/ios_deploy_to_app_store.yml delete mode 100644 sample/.github/workflows/ios_deploy_to_testflight.yml diff --git a/.github/workflows/ios_deploy_production_to_app_store.yml b/.github/workflows/ios_deploy_production_to_app_store.yml new file mode 100644 index 00000000..1b9ea17f --- /dev/null +++ b/.github/workflows/ios_deploy_production_to_app_store.yml @@ -0,0 +1,97 @@ +name: ios-deploy-production-to-app-store +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_app_store: + name: Build And Upload iOS Application To AppStore + runs-on: macOS-latest + environment: production + timeout-minutes: 30 + env: + TEAM_ID: ${{ secrets.TEAM_ID }} + FASTLANE_USER: ${{ secrets.FASTLANE_USER }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} + APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} + APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/.github/workflows/ios_deploy_production_to_testflight.yml b/.github/workflows/ios_deploy_production_to_testflight.yml new file mode 100644 index 00000000..76214cb4 --- /dev/null +++ b/.github/workflows/ios_deploy_production_to_testflight.yml @@ -0,0 +1,97 @@ +name: ios-deploy-production-to-testflight +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_testflight: + name: Build And Upload iOS Application To TestFlight + runs-on: macOS-latest + environment: production + timeout-minutes: 30 + env: + TEAM_ID: ${{ secrets.TEAM_ID }} + FASTLANE_USER: ${{ secrets.FASTLANE_USER }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} + APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} + APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app diff --git a/bricks/template/.idea/vcs.xml b/bricks/template/.idea/vcs.xml new file mode 100644 index 00000000..2926018e --- /dev/null +++ b/bricks/template/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml new file mode 100644 index 00000000..5f6539a7 --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml @@ -0,0 +1,88 @@ +name: ios-deploy-to-app-store +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_app_store: + name: Build And Upload iOS Application To AppStore + runs-on: macOS-latest + timeout-minutes: 30 + env: + TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} + FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}} + FASTLANE_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_PASSWORD{{/mustacheCase}} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD{{/mustacheCase}} + FASTLANE_SESSION: ${{#mustacheCase}}secrets.FASTLANE_SESSION{{/mustacheCase}} + MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} + KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} + APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} + APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} + APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} + GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml new file mode 100644 index 00000000..e2870c40 --- /dev/null +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml @@ -0,0 +1,88 @@ +name: ios-deploy-to-testflight +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_testflight: + name: Build And Upload iOS Application To TestFlight + runs-on: macOS-latest + timeout-minutes: 30 + env: + TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} + FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}} + FASTLANE_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_PASSWORD{{/mustacheCase}} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD{{/mustacheCase}} + FASTLANE_SESSION: ${{#mustacheCase}}secrets.FASTLANE_SESSION{{/mustacheCase}} + MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} + KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} + APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} + APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} + APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} + GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml deleted file mode 100644 index ffc30f95..00000000 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: ios-deploy-to-app-store -on: - # Trigger the workflow on push action - push: - branches: - - develop - -jobs: - build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore - runs-on: macOS-latest - environment: staging - timeout-minutes: 30 - env: - TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} - FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}} - FASTLANE_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_PASSWORD{{/mustacheCase}} - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD{{/mustacheCase}} - FASTLANE_SESSION: ${{#mustacheCase}}secrets.FASTLANE_SESSION{{/mustacheCase}} - MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} - KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} - GITHUB_RUN_NUMBER: $secrets.GITHUB_RUN_NUMBER - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Install SSH key - uses: webfactory/ssh-agent@v0.4.1 - with: - ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Get Flutter dependencies - run: flutter pub get - - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - - name: Bundle install - run: cd ./ios && bundle install - - - name: Pod install - run: cd ./ios && pod install - - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_staging_signing - - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_app_store_connect_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml deleted file mode 100644 index 2734e4bd..00000000 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: ios-deploy-to-testflight -on: - # Trigger the workflow on push action - push: - branches: - - develop - -jobs: - build_and_upload_to_testflight: - name: Build And Upload iOS Application To TestFlight - runs-on: macOS-latest - environment: staging - timeout-minutes: 30 - env: - TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} - FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}} - FASTLANE_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_PASSWORD{{/mustacheCase}} - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{#mustacheCase}}secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD{{/mustacheCase}} - FASTLANE_SESSION: ${{#mustacheCase}}secrets.FASTLANE_SESSION{{/mustacheCase}} - MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}} - KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} - GITHUB_RUN_NUMBER: $secrets.GITHUB_RUN_NUMBER - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Install SSH key - uses: webfactory/ssh-agent@v0.4.1 - with: - ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Get Flutter dependencies - run: flutter pub get - - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - - name: Bundle install - run: cd ./ios && bundle install - - - name: Pod install - run: cd ./ios && pod install - - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_staging_signing - - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb index 49c68679..7efa03b3 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb @@ -15,6 +15,18 @@ def self.TEAM_ID ENV['TEAM_ID'] end + def self.APP_STORE_KEY_ID + ENV['APP_STORE_KEY_ID'] + end + + def self.APP_STORE_ISSUER_ID + ENV['APP_STORE_ISSUER_ID'] + end + + def self.APPSTORE_CONNECT_API_KEY_BASE64 + ENV['APPSTORE_CONNECT_API_KEY_BASE64'] + end + ################# ### Firebase ### ################# diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index 4d0c62ab..a8449240 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -43,6 +43,11 @@ platform :ios do match_manager.sync_adhoc_signing(app_identifier: [Constants.BUNDLE_ID_STAGING]) end + desc 'Sync AppStore Production match signing' + lane :sync_appstore_production_signing do + match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_PRODUCTION]) + end + desc 'Register new devices' lane :register_new_device do device_name = prompt(text: 'Enter the device name: ') @@ -76,6 +81,28 @@ platform :ios do ) end + desc 'Build and upload Production app to Test Flight' + lane :build_and_upload_testflight_production_app do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_production_build_to_testflight + end + + desc 'Upload Production build to Test Flight' + private_lane :upload_production_build_to_testflight do + distribution_manager.upload_to_testflight( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION, + ) + end + # AppStore desc 'Build and upload Staging app to App Store Connect' @@ -99,6 +126,28 @@ platform :ios do ) end + desc 'Build and upload Production app to App Store Connect' + lane :build_and_upload_production_app_store_connect_app do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_build_to_production_app_store_connect + end + + desc 'upload production build to App Store Connect' + private_lane :upload_build_to_production_app_store_connect do + distribution_manager.upload_to_app_store_connect( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION + ) + end + # Firebase desc 'Build and upload Staging app to Firebase' lane :build_and_upload_staging_app do @@ -106,7 +155,7 @@ platform :ios do scheme_name: Constants.SCHEME_NAME_STAGING, product_name: Constants.PRODUCT_NAME_STAGING, bundle_id: Constants.BUNDLE_ID_STAGING, - app_id: Environments.FIREBASE_APP_ID + app_id: Environments.FIREBASE_APP_ID_STAGING ) end @@ -126,6 +175,16 @@ platform :ios do ) end + desc 'Set App Store Connect API key' + lane :set_connect_api_key do + app_store_connect_api_key( + key_id: Environments.APP_STORE_KEY_ID, + issuer_id: Environments.APP_STORE_ISSUER_ID, + key_content: Environments.APPSTORE_CONNECT_API_KEY_BASE64, + is_key_content_base64: true + ) + end + # Private helper lanes desc 'check if any specific version number in build environment' diff --git a/sample/.github/workflows/ios_deploy_production_to_app_store.yml b/sample/.github/workflows/ios_deploy_production_to_app_store.yml new file mode 100644 index 00000000..757062e1 --- /dev/null +++ b/sample/.github/workflows/ios_deploy_production_to_app_store.yml @@ -0,0 +1,97 @@ +name: ios-deploy-production-to-app-store +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_app_store: + name: Build And Upload iOS Application To AppStore + runs-on: macOS-latest + environment: production + timeout-minutes: 30 + env: + TEAM_ID: ${{ secrets.TEAM_ID }} + FASTLANE_USER: ${{ secrets.FASTLANE_USER }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} + APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} + APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/sample/.github/workflows/ios_deploy_production_to_testflight.yml b/sample/.github/workflows/ios_deploy_production_to_testflight.yml new file mode 100644 index 00000000..6d515a9e --- /dev/null +++ b/sample/.github/workflows/ios_deploy_production_to_testflight.yml @@ -0,0 +1,97 @@ +name: ios-deploy-production-to-testflight +on: + # Trigger the workflow on push action + push: + branches: + - main + +jobs: + build_and_upload_to_testflight: + name: Build And Upload iOS Application To TestFlight + runs-on: macOS-latest + environment: production + timeout-minutes: 30 + env: + TEAM_ID: ${{ secrets.TEAM_ID }} + FASTLANE_USER: ${{ secrets.FASTLANE_USER }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} + APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} + APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Bundle install + run: cd ./ios && bundle install + + - name: Pod install + run: cd ./ios && pod install + + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml deleted file mode 100644 index 7ceb4d03..00000000 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: ios-deploy-to-app-store -on: - # Trigger the workflow on push action - push: - branches: - - develop - -jobs: - build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore - runs-on: macOS-latest - environment: staging - timeout-minutes: 30 - env: - TEAM_ID: ${{ secrets.TEAM_ID }} - FASTLANE_USER: ${{ secrets.FASTLANE_USER }} - FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} - FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - GITHUB_RUN_NUMBER: $secrets.GITHUB_RUN_NUMBER - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Install SSH key - uses: webfactory/ssh-agent@v0.4.1 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Get Flutter dependencies - run: flutter pub get - - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - - name: Bundle install - run: cd ./ios && bundle install - - - name: Pod install - run: cd ./ios && pod install - - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_staging_signing - - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_app_store_connect_app diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml deleted file mode 100644 index 6b25d87a..00000000 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: ios-deploy-to-testflight -on: - # Trigger the workflow on push action - push: - branches: - - develop - -jobs: - build_and_upload_to_testflight: - name: Build And Upload iOS Application To TestFlight - runs-on: macOS-latest - environment: staging - timeout-minutes: 30 - env: - TEAM_ID: ${{ secrets.TEAM_ID }} - FASTLANE_USER: ${{ secrets.FASTLANE_USER }} - FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} - FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - GITHUB_RUN_NUMBER: $secrets.GITHUB_RUN_NUMBER - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Install SSH key - uses: webfactory/ssh-agent@v0.4.1 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Get Flutter dependencies - run: flutter pub get - - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - - name: Bundle install - run: cd ./ios && bundle install - - - name: Pod install - run: cd ./ios && pod install - - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_staging_signing - - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_app diff --git a/sample/ios/fastlane/Constants/Environments.rb b/sample/ios/fastlane/Constants/Environments.rb index 49c68679..7efa03b3 100644 --- a/sample/ios/fastlane/Constants/Environments.rb +++ b/sample/ios/fastlane/Constants/Environments.rb @@ -15,6 +15,18 @@ def self.TEAM_ID ENV['TEAM_ID'] end + def self.APP_STORE_KEY_ID + ENV['APP_STORE_KEY_ID'] + end + + def self.APP_STORE_ISSUER_ID + ENV['APP_STORE_ISSUER_ID'] + end + + def self.APPSTORE_CONNECT_API_KEY_BASE64 + ENV['APPSTORE_CONNECT_API_KEY_BASE64'] + end + ################# ### Firebase ### ################# diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index 4d0c62ab..b453eca4 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -43,6 +43,11 @@ platform :ios do match_manager.sync_adhoc_signing(app_identifier: [Constants.BUNDLE_ID_STAGING]) end + desc 'Sync AppStore Production match signing' + lane :sync_appstore_production_signing do + match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_PRODUCTION]) + end + desc 'Register new devices' lane :register_new_device do device_name = prompt(text: 'Enter the device name: ') @@ -76,6 +81,27 @@ platform :ios do ) end + desc 'Build and upload Production app to Test Flight' + lane :build_and_upload_testflight_production_app do + set_app_version + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_production_build_to_testflight + end + + desc 'Upload Production build to Test Flight' + private_lane :upload_production_build_to_testflight do + distribution_manager.upload_to_testflight( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION, + ) + end + # AppStore desc 'Build and upload Staging app to App Store Connect' @@ -88,6 +114,7 @@ platform :ios do Constants.BUNDLE_ID_STAGING, false ) + set_connect_api_key upload_build_to_app_store_connect end @@ -126,6 +153,16 @@ platform :ios do ) end + desc 'Set App Store Connect API key' + lane :set_connect_api_key do + app_store_connect_api_key( + key_id: Environments.APP_STORE_KEY_ID, + issuer_id: Environments.APP_STORE_ISSUER_ID, + key_content: Environments.APPSTORE_CONNECT_API_KEY_BASE64, + is_key_content_base64: true + ) + end + # Private helper lanes desc 'check if any specific version number in build environment' From e541ea4afecda81cb99f69c45088551ebcce17b9 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Mon, 14 Aug 2023 16:16:36 +0700 Subject: [PATCH 31/53] [#169] Remove unused file --- bricks/template/.idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 bricks/template/.idea/vcs.xml diff --git a/bricks/template/.idea/vcs.xml b/bricks/template/.idea/vcs.xml deleted file mode 100644 index 2926018e..00000000 --- a/bricks/template/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - From 6845fba317ef5f47a67078decade6204a88c8d3a Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 15:01:09 +0700 Subject: [PATCH 32/53] [#169] Revert name to easy find the changes --- ..._production_to_app_store.yml => ios_deploy_to_app_store.yml} | 2 +- ...roduction_to_testflight.yml => ios_deploy_to_testflight.yml} | 2 +- ..._production_to_app_store.yml => ios_deploy_to_app_store.yml} | 0 ...roduction_to_testflight.yml => ios_deploy_to_testflight.yml} | 0 ..._production_to_app_store.yml => ios_deploy_to_app_store.yml} | 2 +- ...roduction_to_testflight.yml => ios_deploy_to_testflight.yml} | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{ios_deploy_production_to_app_store.yml => ios_deploy_to_app_store.yml} (98%) rename .github/workflows/{ios_deploy_production_to_testflight.yml => ios_deploy_to_testflight.yml} (98%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/{ios_deploy_production_to_app_store.yml => ios_deploy_to_app_store.yml} (100%) rename bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/{ios_deploy_production_to_testflight.yml => ios_deploy_to_testflight.yml} (100%) rename sample/.github/workflows/{ios_deploy_production_to_app_store.yml => ios_deploy_to_app_store.yml} (98%) rename sample/.github/workflows/{ios_deploy_production_to_testflight.yml => ios_deploy_to_testflight.yml} (98%) diff --git a/.github/workflows/ios_deploy_production_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml similarity index 98% rename from .github/workflows/ios_deploy_production_to_app_store.yml rename to .github/workflows/ios_deploy_to_app_store.yml index 1b9ea17f..6c356f1b 100644 --- a/.github/workflows/ios_deploy_production_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -1,4 +1,4 @@ -name: ios-deploy-production-to-app-store +name: ios-deploy-to-app-store on: # Trigger the workflow on push action push: diff --git a/.github/workflows/ios_deploy_production_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml similarity index 98% rename from .github/workflows/ios_deploy_production_to_testflight.yml rename to .github/workflows/ios_deploy_to_testflight.yml index 76214cb4..333fad83 100644 --- a/.github/workflows/ios_deploy_production_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -1,4 +1,4 @@ -name: ios-deploy-production-to-testflight +name: ios-deploy-to-testflight on: # Trigger the workflow on push action push: diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_app_store.yml rename to bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml similarity index 100% rename from bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_production_to_testflight.yml rename to bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml diff --git a/sample/.github/workflows/ios_deploy_production_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml similarity index 98% rename from sample/.github/workflows/ios_deploy_production_to_app_store.yml rename to sample/.github/workflows/ios_deploy_to_app_store.yml index 757062e1..7f747799 100644 --- a/sample/.github/workflows/ios_deploy_production_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -1,4 +1,4 @@ -name: ios-deploy-production-to-app-store +name: ios-deploy-to-app-store on: # Trigger the workflow on push action push: diff --git a/sample/.github/workflows/ios_deploy_production_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml similarity index 98% rename from sample/.github/workflows/ios_deploy_production_to_testflight.yml rename to sample/.github/workflows/ios_deploy_to_testflight.yml index 6d515a9e..9ed2de84 100644 --- a/sample/.github/workflows/ios_deploy_production_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -1,4 +1,4 @@ -name: ios-deploy-production-to-testflight +name: ios-deploy-to-testflight on: # Trigger the workflow on push action push: From fa831770154b07965969583019fbeef8a9d4311f Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 15:08:08 +0700 Subject: [PATCH 33/53] [#169] Update indent --- .../workflows/ios_deploy_to_app_store.yml | 1 + .../workflows/ios_deploy_to_testflight.yml | 103 +++++++++--------- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 5f6539a7..e9e5507e 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_app_store: name: Build And Upload iOS Application To AppStore runs-on: macOS-latest + environment: production timeout-minutes: 30 env: TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index e2870c40..7023e59c 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -9,6 +9,7 @@ jobs: build_and_upload_to_testflight: name: Build And Upload iOS Application To TestFlight runs-on: macOS-latest + environment: production timeout-minutes: 30 env: TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}} @@ -23,66 +24,66 @@ jobs: APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app From 2a3709e7316061bb087e72e2fc7a604cf8c8d4b9 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 15:13:05 +0700 Subject: [PATCH 34/53] [#169] Update indent for app store flow --- .../workflows/ios_deploy_to_app_store.yml | 102 +++++++++--------- .../workflows/ios_deploy_to_testflight.yml | 2 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index e9e5507e..e8c67ded 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -24,66 +24,66 @@ jobs: APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 7023e59c..49a3ac78 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -30,7 +30,7 @@ jobs: - name: Install SSH key uses: webfactory/ssh-agent@v0.7.0 with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - name: Set up Flutter environment uses: subosito/flutter-action@v2 From ad4971a79bf568769bdb108794a1320e554dfb3f Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 15:14:01 +0700 Subject: [PATCH 35/53] [#169] Update mustacheCase for PRIVATE KEY --- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index e8c67ded..6e19b35c 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -30,7 +30,7 @@ jobs: - name: Install SSH key uses: webfactory/ssh-agent@v0.7.0 with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - name: Set up Flutter environment uses: subosito/flutter-action@v2 From a745c66a2bf9f9018c2a0ec5b4f16e784d4b50cc Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 17 Aug 2023 15:19:08 +0700 Subject: [PATCH 36/53] [#169] Update sample indent --- .../workflows/ios_deploy_to_app_store.yml | 112 ++++++++--------- .../workflows/ios_deploy_to_testflight.yml | 114 +++++++++--------- 2 files changed, 113 insertions(+), 113 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index 7f747799..c928ecb8 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -24,74 +24,74 @@ jobs: APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane + - name: Update fastlane + run: cd ./ios && bundle update fastlane - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} - - name: Deploy to AppStore - run: | + - name: Deploy to AppStore + run: | cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 9ed2de84..333fad83 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -24,74 +24,74 @@ jobs: APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane + - name: Update fastlane + run: cd ./ios && bundle update fastlane - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app From b26e3508735482ec87179317fe2b8c75bef66238 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Mon, 28 Aug 2023 03:04:18 +0000 Subject: [PATCH 37/53] [Chore] Generate & update sample project --- .../workflows/ios_deploy_to_app_store.yml | 20 ++++--------- .../workflows/ios_deploy_to_testflight.yml | 30 +++++++------------ sample/ios/fastlane/Fastfile | 24 ++++++++++++++- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index c928ecb8..d3ed43b3 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: $ run: | echo -e ENV >> .env @@ -64,16 +64,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: $-gems-$ + restore-keys: $-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + key: $-pods-$ + restore-keys: $-pods- - name: Bundle install run: cd ./ios && bundle install @@ -81,17 +81,9 @@ jobs: - name: Pod install run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane - - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} - name: Deploy to AppStore run: | - cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 333fad83..f5e79a05 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -40,19 +40,19 @@ jobs: - name: Generate new project run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - name: Get Flutter dependencies run: flutter pub get - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: $ run: | echo -e ENV >> .env @@ -64,16 +64,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: $-gems-$ + restore-keys: $-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + key: $-pods-$ + restore-keys: $-pods- - name: Bundle install run: cd ./ios && bundle install @@ -81,16 +81,8 @@ jobs: - name: Pod install run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane - - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} - name: Deploy to TestFlight run: | diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index b453eca4..cad08055 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -84,6 +84,7 @@ platform :ios do desc 'Build and upload Production app to Test Flight' lane :build_and_upload_testflight_production_app do set_app_version + bump_build builder.build_app_store( Constants.SCHEME_NAME_PRODUCTION, Constants.PRODUCT_NAME_PRODUCTION, @@ -114,7 +115,6 @@ platform :ios do Constants.BUNDLE_ID_STAGING, false ) - set_connect_api_key upload_build_to_app_store_connect end @@ -126,6 +126,28 @@ platform :ios do ) end + desc 'Build and upload Production app to App Store Connect' + lane :build_and_upload_production_app_store_connect_app do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_build_to_production_app_store_connect + end + + desc 'upload production build to App Store Connect' + private_lane :upload_build_to_production_app_store_connect do + distribution_manager.upload_to_app_store_connect( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION + ) + end + # Firebase desc 'Build and upload Staging app to Firebase' lane :build_and_upload_staging_app do From a94a6039fbc0a99929ed355860f535177e40e130 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Tue, 29 Aug 2023 12:02:33 +0700 Subject: [PATCH 38/53] [#169] Format Fastfile and update sample env --- .../workflows/android_deploy_production.yml | 2 +- ...android_deploy_production_to_playstore.yml | 2 +- .github/workflows/android_deploy_staging.yml | 2 +- .../ios_deploy_staging_to_firebase.yml | 2 +- .../workflows/android_deploy_production.yml | 2 +- ...android_deploy_production_to_playstore.yml | 2 +- .../workflows/android_deploy_staging.yml | 2 +- .../ios_deploy_staging_to_firebase.yml | 2 +- .../ios/fastlane/Fastfile | 38 +++++++++---------- .../workflows/android_deploy_production.yml | 2 +- ...android_deploy_production_to_playstore.yml | 2 +- .../workflows/android_deploy_staging.yml | 2 +- .../ios_deploy_staging_to_firebase.yml | 2 +- .../workflows/ios_deploy_to_app_store.yml | 2 +- .../workflows/ios_deploy_to_testflight.yml | 2 +- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/android_deploy_production.yml b/.github/workflows/android_deploy_production.yml index 0d948330..0a7725f7 100644 --- a/.github/workflows/android_deploy_production.yml +++ b/.github/workflows/android_deploy_production.yml @@ -46,7 +46,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/.github/workflows/android_deploy_production_to_playstore.yml b/.github/workflows/android_deploy_production_to_playstore.yml index cdeb2f09..5f9fadb2 100644 --- a/.github/workflows/android_deploy_production_to_playstore.yml +++ b/.github/workflows/android_deploy_production_to_playstore.yml @@ -46,7 +46,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env - name: Set up release signing configs env: diff --git a/.github/workflows/android_deploy_staging.yml b/.github/workflows/android_deploy_staging.yml index d5915c41..3261228f 100644 --- a/.github/workflows/android_deploy_staging.yml +++ b/.github/workflows/android_deploy_staging.yml @@ -46,7 +46,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/.github/workflows/ios_deploy_staging_to_firebase.yml b/.github/workflows/ios_deploy_staging_to_firebase.yml index ac7f4d66..e56615e4 100644 --- a/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -53,7 +53,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml index 1cb8daa7..f73c2c71 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml index 5b9d4190..fa85666b 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_production_to_playstore.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env - name: Set up release signing configs env: diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml index d318a132..175eaee1 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/android_deploy_staging.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml index 4a232a86..fd5e6b08 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -44,7 +44,7 @@ jobs: env: ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index a8449240..4fd2e159 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -127,26 +127,26 @@ platform :ios do end desc 'Build and upload Production app to App Store Connect' - lane :build_and_upload_production_app_store_connect_app do - set_app_version - bump_build - builder.build_app_store( - Constants.SCHEME_NAME_PRODUCTION, - Constants.PRODUCT_NAME_PRODUCTION, - Constants.BUNDLE_ID_PRODUCTION, - false - ) - set_connect_api_key - upload_build_to_production_app_store_connect - end + lane :build_and_upload_production_app_store_connect_app do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_build_to_production_app_store_connect + end - desc 'upload production build to App Store Connect' - private_lane :upload_build_to_production_app_store_connect do - distribution_manager.upload_to_app_store_connect( - product_name: Constants.PRODUCT_NAME_PRODUCTION, - bundle_identifier: Constants.BUNDLE_ID_PRODUCTION - ) - end + desc 'upload production build to App Store Connect' + private_lane :upload_build_to_production_app_store_connect do + distribution_manager.upload_to_app_store_connect( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION + ) + end # Firebase desc 'Build and upload Staging app to Firebase' diff --git a/sample/.github/workflows/android_deploy_production.yml b/sample/.github/workflows/android_deploy_production.yml index 0fe0d6b9..c05c3fa0 100644 --- a/sample/.github/workflows/android_deploy_production.yml +++ b/sample/.github/workflows/android_deploy_production.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/sample/.github/workflows/android_deploy_production_to_playstore.yml b/sample/.github/workflows/android_deploy_production_to_playstore.yml index 0a18534e..3725357b 100644 --- a/sample/.github/workflows/android_deploy_production_to_playstore.yml +++ b/sample/.github/workflows/android_deploy_production_to_playstore.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env + echo -e "$ENV" > .env - name: Set up release signing configs env: diff --git a/sample/.github/workflows/android_deploy_staging.yml b/sample/.github/workflows/android_deploy_staging.yml index 351f3792..c4c64aea 100644 --- a/sample/.github/workflows/android_deploy_staging.yml +++ b/sample/.github/workflows/android_deploy_staging.yml @@ -37,7 +37,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging # App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa - name: Build Android apk diff --git a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml index 3bc27e76..9fbc3f57 100644 --- a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -44,7 +44,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo "$ENV" > .env.staging + echo -e "$ENV" > .env.staging - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index d3ed43b3..47270a4b 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: $ + ENV: ${{ secrets.ENV }} run: | echo -e ENV >> .env diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index f5e79a05..64b3c9ad 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: $ + ENV: ${{ secrets.ENV }} run: | echo -e ENV >> .env From a497ef6768830e30f6ecd7e83f3bde0f71d4c7f6 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Tue, 29 Aug 2023 05:08:25 +0000 Subject: [PATCH 39/53] [Chore] Generate & update sample project --- .../workflows/ios_deploy_to_app_store.yml | 2 +- .../workflows/ios_deploy_to_testflight.yml | 2 +- sample/ios/fastlane/Fastfile | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index 47270a4b..d3ed43b3 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: $ run: | echo -e ENV >> .env diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 64b3c9ad..f5e79a05 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: $ run: | echo -e ENV >> .env diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index cad08055..77a9cff7 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -127,26 +127,26 @@ platform :ios do end desc 'Build and upload Production app to App Store Connect' - lane :build_and_upload_production_app_store_connect_app do - set_app_version - bump_build - builder.build_app_store( - Constants.SCHEME_NAME_PRODUCTION, - Constants.PRODUCT_NAME_PRODUCTION, - Constants.BUNDLE_ID_PRODUCTION, - false - ) - set_connect_api_key - upload_build_to_production_app_store_connect - end + lane :build_and_upload_production_app_store_connect_app do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_connect_api_key + upload_build_to_production_app_store_connect + end - desc 'upload production build to App Store Connect' - private_lane :upload_build_to_production_app_store_connect do - distribution_manager.upload_to_app_store_connect( - product_name: Constants.PRODUCT_NAME_PRODUCTION, - bundle_identifier: Constants.BUNDLE_ID_PRODUCTION - ) - end + desc 'upload production build to App Store Connect' + private_lane :upload_build_to_production_app_store_connect do + distribution_manager.upload_to_app_store_connect( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION + ) + end # Firebase desc 'Build and upload Staging app to Firebase' From 7ddf6cdf60e6f47824aa7311ee1ff0b268e1db0a Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 10:51:52 +0700 Subject: [PATCH 40/53] [#169] Update name and indent --- .../.github/workflows/ios_deploy_to_app_store.yml | 4 ++-- .../.github/workflows/ios_deploy_to_testflight.yml | 4 ++-- .../ios/fastlane/Constants/Environments.rb | 2 +- .../{{project_name.snakeCase()}}/ios/fastlane/Fastfile | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 6e19b35c..e9578230 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-app-store +name: ios-deploy-production-to-app-store on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore + name: Build And Upload iOS Application Production To AppStore runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 49a3ac78..9d44107d 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-testflight +name: ios-deploy-production-to-testflight on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_testflight: - name: Build And Upload iOS Application To TestFlight + name: Build And Upload iOS Application Production To TestFlight runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb index 7efa03b3..369c663a 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb @@ -24,7 +24,7 @@ def self.APP_STORE_ISSUER_ID end def self.APPSTORE_CONNECT_API_KEY_BASE64 - ENV['APPSTORE_CONNECT_API_KEY_BASE64'] + ENV['APP_STORE_CONNECT_API_KEY_BASE64'] end ################# diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index 4fd2e159..77a9cff7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -155,7 +155,7 @@ platform :ios do scheme_name: Constants.SCHEME_NAME_STAGING, product_name: Constants.PRODUCT_NAME_STAGING, bundle_id: Constants.BUNDLE_ID_STAGING, - app_id: Environments.FIREBASE_APP_ID_STAGING + app_id: Environments.FIREBASE_APP_ID ) end From 7f0f15f51bf30822457c9c74e77ab35fa55e9750 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Thu, 31 Aug 2023 03:58:27 +0000 Subject: [PATCH 41/53] [Chore] Generate & update sample project --- sample/.github/workflows/ios_deploy_to_app_store.yml | 4 ++-- sample/.github/workflows/ios_deploy_to_testflight.yml | 4 ++-- sample/ios/fastlane/Constants/Environments.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index d3ed43b3..c0cf66cc 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-app-store +name: ios-deploy-production-to-app-store on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore + name: Build And Upload iOS Application Production To AppStore runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index f5e79a05..2df5c825 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-testflight +name: ios-deploy-production-to-testflight on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_testflight: - name: Build And Upload iOS Application To TestFlight + name: Build And Upload iOS Application Production To TestFlight runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/sample/ios/fastlane/Constants/Environments.rb b/sample/ios/fastlane/Constants/Environments.rb index 7efa03b3..369c663a 100644 --- a/sample/ios/fastlane/Constants/Environments.rb +++ b/sample/ios/fastlane/Constants/Environments.rb @@ -24,7 +24,7 @@ def self.APP_STORE_ISSUER_ID end def self.APPSTORE_CONNECT_API_KEY_BASE64 - ENV['APPSTORE_CONNECT_API_KEY_BASE64'] + ENV['APP_STORE_CONNECT_API_KEY_BASE64'] end ################# From 9c812263874e849ab496b6296c0a300189238f39 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 10:58:37 +0700 Subject: [PATCH 42/53] [#169] Update APP_STORE_CONNECT_API_KEY_BASE64 name --- .github/workflows/ios_deploy_to_app_store.yml | 2 +- .github/workflows/ios_deploy_to_testflight.yml | 2 +- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- .../.github/workflows/ios_deploy_to_testflight.yml | 2 +- .../ios/fastlane/Constants/Environments.rb | 2 +- .../{{project_name.snakeCase()}}/ios/fastlane/Fastfile | 2 +- sample/.github/workflows/ios_deploy_to_app_store.yml | 2 +- sample/.github/workflows/ios_deploy_to_testflight.yml | 2 +- sample/ios/fastlane/Constants/Environments.rb | 2 +- sample/ios/fastlane/Fastfile | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml index 6c356f1b..c42d9b19 100644 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} - APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - name: Check out diff --git a/.github/workflows/ios_deploy_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml index 333fad83..0e08cfb3 100644 --- a/.github/workflows/ios_deploy_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} - APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - name: Check out diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index e9578230..a1026de1 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} - APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} + APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} steps: - name: Check out diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 9d44107d..6587da33 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}} APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} - APPSTORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APPSTORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} + APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} steps: - name: Check out diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb index 369c663a..2900ccd5 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Constants/Environments.rb @@ -23,7 +23,7 @@ def self.APP_STORE_ISSUER_ID ENV['APP_STORE_ISSUER_ID'] end - def self.APPSTORE_CONNECT_API_KEY_BASE64 + def self.APP_STORE_CONNECT_API_KEY_BASE64 ENV['APP_STORE_CONNECT_API_KEY_BASE64'] end diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index 77a9cff7..6ada262f 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -180,7 +180,7 @@ platform :ios do app_store_connect_api_key( key_id: Environments.APP_STORE_KEY_ID, issuer_id: Environments.APP_STORE_ISSUER_ID, - key_content: Environments.APPSTORE_CONNECT_API_KEY_BASE64, + key_content: Environments.APP_STORE_CONNECT_API_KEY_BASE64, is_key_content_base64: true ) end diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index c0cf66cc..a8ba5618 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} - APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - name: Check out diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 2df5c825..674de133 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -21,7 +21,7 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} - APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_API_KEY_BASE64 }} + APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} steps: - name: Check out diff --git a/sample/ios/fastlane/Constants/Environments.rb b/sample/ios/fastlane/Constants/Environments.rb index 369c663a..2900ccd5 100644 --- a/sample/ios/fastlane/Constants/Environments.rb +++ b/sample/ios/fastlane/Constants/Environments.rb @@ -23,7 +23,7 @@ def self.APP_STORE_ISSUER_ID ENV['APP_STORE_ISSUER_ID'] end - def self.APPSTORE_CONNECT_API_KEY_BASE64 + def self.APP_STORE_CONNECT_API_KEY_BASE64 ENV['APP_STORE_CONNECT_API_KEY_BASE64'] end diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index 77a9cff7..6ada262f 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -180,7 +180,7 @@ platform :ios do app_store_connect_api_key( key_id: Environments.APP_STORE_KEY_ID, issuer_id: Environments.APP_STORE_ISSUER_ID, - key_content: Environments.APPSTORE_CONNECT_API_KEY_BASE64, + key_content: Environments.APP_STORE_CONNECT_API_KEY_BASE64, is_key_content_base64: true ) end From b79e9cf2f9fc2bba10299f374a3fbd3b5178e3c0 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 11:01:38 +0700 Subject: [PATCH 43/53] [#169] Update GITHUB_RUN_NUMBER --- .github/workflows/ios_deploy_to_app_store.yml | 4 ++-- .github/workflows/ios_deploy_to_testflight.yml | 4 ++-- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- .../.github/workflows/ios_deploy_to_testflight.yml | 2 +- sample/.github/workflows/ios_deploy_to_app_store.yml | 2 +- sample/.github/workflows/ios_deploy_to_testflight.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml index c42d9b19..3fc133c1 100644 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 @@ -90,7 +90,7 @@ jobs: - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to AppStore run: | diff --git a/.github/workflows/ios_deploy_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml index 0e08cfb3..4dac9fc7 100644 --- a/.github/workflows/ios_deploy_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 @@ -90,7 +90,7 @@ jobs: - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing env: - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to TestFlight run: | diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index a1026de1..5fda3e12 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} - GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 6587da33..bd9c70bd 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{#mustacheCase}}secrets.APP_STORE_KEY_ID{{/mustacheCase}} APP_STORE_ISSUER_ID: ${{#mustacheCase}}secrets.APP_STORE_ISSUER_ID{{/mustacheCase}} APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} - GITHUB_RUN_NUMBER: ${{#mustacheCase}}secrets.GITHUB_RUN_NUMBER{{/mustacheCase}} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index a8ba5618..b6134019 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 674de133..4adf532e 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -22,7 +22,7 @@ jobs: APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} - GITHUB_RUN_NUMBER: ${{ secrets.GITHUB_RUN_NUMBER }} + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - name: Check out uses: actions/checkout@v3 From c886304b95ca68071fce7202ae62aac17a82e9f5 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 11:19:06 +0700 Subject: [PATCH 44/53] [#169] Format ios deploy files --- .github/workflows/ios_deploy_to_app_store.yml | 114 +++++++++--------- .../workflows/ios_deploy_to_testflight.yml | 114 +++++++++--------- .../workflows/ios_deploy_to_app_store.yml | 102 ++++++++-------- .../workflows/ios_deploy_to_testflight.yml | 102 ++++++++-------- .../workflows/ios_deploy_to_app_store.yml | 102 ++++++++-------- .../workflows/ios_deploy_to_testflight.yml | 102 ++++++++-------- 6 files changed, 318 insertions(+), 318 deletions(-) diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml index 3fc133c1..41e31ebf 100644 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -24,74 +24,74 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane + - name: Update fastlane + run: cd ./ios && bundle update fastlane - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/.github/workflows/ios_deploy_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml index 4dac9fc7..2542c107 100644 --- a/.github/workflows/ios_deploy_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -24,74 +24,74 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Update fastlane - run: cd ./ios && bundle update fastlane + - name: Update fastlane + run: cd ./ios && bundle update fastlane - - name: Update plugins - run: cd ./ios && bundle exec fastlane update_plugins + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - env: - GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 5fda3e12..a69a444f 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -24,66 +24,66 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index bd9c70bd..d35e3dfc 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -24,66 +24,66 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{#mustacheCase}}secrets.APP_STORE_CONNECT_API_KEY_BASE64{{/mustacheCase}} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{#mustacheCase}}secrets.SSH_PRIVATE_KEY{{/mustacheCase}} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: ${{ secrets.ENV }} - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: ${{ secrets.ENV }} + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index b6134019..fafc8621 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -24,66 +24,66 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: $ - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: $ + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: $-gems-$ - restore-keys: $-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: $-gems-$ + restore-keys: $-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: $-pods-$ - restore-keys: $-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: $-pods-$ + restore-keys: $-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app + - name: Deploy to AppStore + run: | + cd ./ios && bundle exec fastlane build_and_upload_production_app_store_connect_app diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 4adf532e..d1f57f8e 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -24,66 +24,66 @@ jobs: APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER steps: - - name: Check out - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 - - name: Install SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Install SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample + - name: Generate new project + run: | + dart pub global activate mason_cli + mason get + mason make template -c mason-config.json + # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis + rsync -av --remove-source-files flutter_templates/ ./ + rm -rf bricks sample - - name: Get Flutter dependencies - run: flutter pub get + - name: Get Flutter dependencies + run: flutter pub get - - name: Set up Production env - env: - ENV: $ - run: | - echo -e ENV >> .env + - name: Set up Production env + env: + ENV: $ + run: | + echo -e ENV >> .env - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Cache Ruby gems - uses: actions/cache@v3 - id: bunlderCache - with: - path: ios/vendor/bundle - key: $-gems-$ - restore-keys: $-gems- + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: $-gems-$ + restore-keys: $-gems- - - name: Cache Pods - uses: actions/cache@v3 - id: cocoapodCache - with: - path: ios/Pods - key: $-pods-$ - restore-keys: $-pods- + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: $-pods-$ + restore-keys: $-pods- - - name: Bundle install - run: cd ./ios && bundle install + - name: Bundle install + run: cd ./ios && bundle install - - name: Pod install - run: cd ./ios && pod install + - name: Pod install + run: cd ./ios && pod install - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + - name: Match AppStore + run: cd ./ios && bundle exec fastlane sync_appstore_production_signing - - name: Deploy to TestFlight - run: | - cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app + - name: Deploy to TestFlight + run: | + cd ./ios && bundle exec fastlane build_and_upload_testflight_production_app From c090c40afdf1af3c630e176f87dbc6a02a0c5066 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 14:35:30 +0700 Subject: [PATCH 45/53] [#169] Update echo ENV --- .github/workflows/ios_deploy_to_app_store.yml | 2 +- .github/workflows/ios_deploy_to_testflight.yml | 2 +- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- .../.github/workflows/ios_deploy_to_testflight.yml | 2 +- sample/.github/workflows/ios_deploy_to_app_store.yml | 2 +- sample/.github/workflows/ios_deploy_to_testflight.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml index 41e31ebf..72944b63 100644 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -54,7 +54,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/.github/workflows/ios_deploy_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml index 2542c107..d6d101d5 100644 --- a/.github/workflows/ios_deploy_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -54,7 +54,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index a69a444f..1d34a0a8 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -54,7 +54,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index d35e3dfc..e2a0bbee 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -54,7 +54,7 @@ jobs: env: ENV: ${{ secrets.ENV }} run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index fafc8621..021fabd8 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -54,7 +54,7 @@ jobs: env: ENV: $ run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index d1f57f8e..b57d19ce 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -54,7 +54,7 @@ jobs: env: ENV: $ run: | - echo -e ENV >> .env + echo -e "$ENV" >> .env - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs From 4e4e68870d90b266652b363ce26968997d09f706 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 14:36:59 +0700 Subject: [PATCH 46/53] [#169] Update set_app_store_connect_api_key name --- .../{{project_name.snakeCase()}}/ios/fastlane/Fastfile | 6 +++--- sample/ios/fastlane/Fastfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile index 6ada262f..71bf3415 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/ios/fastlane/Fastfile @@ -91,7 +91,7 @@ platform :ios do Constants.BUNDLE_ID_PRODUCTION, false ) - set_connect_api_key + set_app_store_connect_api_key upload_production_build_to_testflight end @@ -136,7 +136,7 @@ platform :ios do Constants.BUNDLE_ID_PRODUCTION, false ) - set_connect_api_key + set_app_store_connect_api_key upload_build_to_production_app_store_connect end @@ -176,7 +176,7 @@ platform :ios do end desc 'Set App Store Connect API key' - lane :set_connect_api_key do + lane :set_app_store_connect_api_key do app_store_connect_api_key( key_id: Environments.APP_STORE_KEY_ID, issuer_id: Environments.APP_STORE_ISSUER_ID, diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index 6ada262f..71bf3415 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -91,7 +91,7 @@ platform :ios do Constants.BUNDLE_ID_PRODUCTION, false ) - set_connect_api_key + set_app_store_connect_api_key upload_production_build_to_testflight end @@ -136,7 +136,7 @@ platform :ios do Constants.BUNDLE_ID_PRODUCTION, false ) - set_connect_api_key + set_app_store_connect_api_key upload_build_to_production_app_store_connect end @@ -176,7 +176,7 @@ platform :ios do end desc 'Set App Store Connect API key' - lane :set_connect_api_key do + lane :set_app_store_connect_api_key do app_store_connect_api_key( key_id: Environments.APP_STORE_KEY_ID, issuer_id: Environments.APP_STORE_ISSUER_ID, From f2b8ce47d8df77c47f5415e3acc8ec8bc4a09c4f Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 16:28:32 +0700 Subject: [PATCH 47/53] [#169] Update env name --- .github/workflows/ios_deploy_to_app_store.yml | 4 ++-- .github/workflows/ios_deploy_to_testflight.yml | 4 ++-- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- .../.github/workflows/ios_deploy_to_testflight.yml | 2 +- sample/.github/workflows/ios_deploy_to_app_store.yml | 2 +- sample/.github/workflows/ios_deploy_to_testflight.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml index 72944b63..b2da332c 100644 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ b/.github/workflows/ios_deploy_to_app_store.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-app-store +name: ios-deploy-production-to-app-store on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore + name: Build And Upload iOS Application Production To AppStore runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/.github/workflows/ios_deploy_to_testflight.yml b/.github/workflows/ios_deploy_to_testflight.yml index d6d101d5..52ac52ae 100644 --- a/.github/workflows/ios_deploy_to_testflight.yml +++ b/.github/workflows/ios_deploy_to_testflight.yml @@ -1,4 +1,4 @@ -name: ios-deploy-to-testflight +name: ios-deploy-production-to-testflight on: # Trigger the workflow on push action push: @@ -7,7 +7,7 @@ on: jobs: build_and_upload_to_testflight: - name: Build And Upload iOS Application To TestFlight + name: Build And Upload iOS Application Production To TestFlight runs-on: macOS-latest environment: production timeout-minutes: 30 diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 1d34a0a8..769127f7 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{#mustacheCase}} secrets.ENV {{/mustacheCase}} run: | echo -e "$ENV" >> .env diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index e2a0bbee..31330732 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{#mustacheCase}} secrets.ENV {{/mustacheCase}} run: | echo -e "$ENV" >> .env diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index 021fabd8..fc8b368a 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: $ + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index b57d19ce..85aebf5e 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: $ + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env From 47d9b1e29e3bfabb6cada0a09b68a7e215d524a2 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Thu, 31 Aug 2023 09:33:27 +0000 Subject: [PATCH 48/53] [Chore] Generate & update sample project --- sample/.github/workflows/ios_deploy_to_app_store.yml | 2 +- sample/.github/workflows/ios_deploy_to_testflight.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index fc8b368a..17eba623 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 85aebf5e..4f9c1254 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -52,7 +52,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env From 7e0beee8411778f1dadfa94671dea93bba69dff9 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Thu, 31 Aug 2023 16:50:54 +0700 Subject: [PATCH 49/53] [#169] Fix missing comments --- .../workflows/ios_deploy_to_app_store.yml | 23 ++++++++--------- .../workflows/ios_deploy_to_testflight.yml | 25 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 769127f7..37069ea3 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -38,15 +38,6 @@ jobs: channel: 'stable' flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample - - name: Get Flutter dependencies run: flutter pub get @@ -64,15 +55,15 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems-${{#mustacheCase}} hashFiles('**/Gemfile.lock') {{/mustacheCase}} + restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods-${{#mustacheCase}} hashFiles('**/Podfile.lock') {{/mustacheCase}} restore-keys: ${{ runner.os }}-pods- - name: Bundle install @@ -81,8 +72,16 @@ jobs: - name: Pod install run: cd ./ios && pod install + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to AppStore run: | diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 31330732..45edb3b9 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -38,15 +38,6 @@ jobs: channel: 'stable' flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample - - name: Get Flutter dependencies run: flutter pub get @@ -64,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems-${{#mustacheCase}} hashFiles('**/Gemfile.lock') {{/mustacheCase}} + restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods-${{#mustacheCase}} hashFiles('**/Podfile.lock') {{/mustacheCase}} + restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods- - name: Bundle install run: cd ./ios && bundle install @@ -81,8 +72,16 @@ jobs: - name: Pod install run: cd ./ios && pod install + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to TestFlight run: | From db787be4f2fa184c6e519448d00102d3e53e8f33 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Thu, 31 Aug 2023 09:56:14 +0000 Subject: [PATCH 50/53] [Chore] Generate & update sample project --- .../workflows/ios_deploy_to_app_store.yml | 23 ++++++++--------- .../workflows/ios_deploy_to_testflight.yml | 25 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index 17eba623..e54e3f8b 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -38,15 +38,6 @@ jobs: channel: 'stable' flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample - - name: Get Flutter dependencies run: flutter pub get @@ -64,15 +55,15 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: $-gems-$ - restore-keys: $-gems- + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: $-pods-$ + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: $-pods- - name: Bundle install @@ -81,8 +72,16 @@ jobs: - name: Pod install run: cd ./ios && pod install + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to AppStore run: | diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 4f9c1254..4c08e665 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -38,15 +38,6 @@ jobs: channel: 'stable' flutter-version: '3.10.5' - - name: Generate new project - run: | - dart pub global activate mason_cli - mason get - mason make template -c mason-config.json - # Move the generated project to the root directory for next steps & cleanup to not affect static code analysis - rsync -av --remove-source-files flutter_templates/ ./ - rm -rf bricks sample - - name: Get Flutter dependencies run: flutter pub get @@ -64,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: $-gems-$ - restore-keys: $-gems- + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: $-pods-$ - restore-keys: $-pods- + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - name: Bundle install run: cd ./ios && bundle install @@ -81,8 +72,16 @@ jobs: - name: Pod install run: cd ./ios && pod install + - name: Update fastlane + run: cd ./ios && bundle update fastlane + + - name: Update plugins + run: cd ./ios && bundle exec fastlane update_plugins + - name: Match AppStore run: cd ./ios && bundle exec fastlane sync_appstore_production_signing + env: + GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER - name: Deploy to TestFlight run: | From 9309890c9fd2f6983d34eb48951b64ee382686eb Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 6 Sep 2023 11:28:06 +0700 Subject: [PATCH 51/53] [#169] Format spacing --- .../.github/workflows/ios_deploy_to_app_store.yml | 10 +++++----- .../.github/workflows/ios_deploy_to_testflight.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index 37069ea3..c6a3f0b5 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -43,7 +43,7 @@ jobs: - name: Set up Production env env: - ENV: ${{#mustacheCase}} secrets.ENV {{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | echo -e "$ENV" >> .env @@ -55,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems-${{#mustacheCase}} hashFiles('**/Gemfile.lock') {{/mustacheCase}} - restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems- + key: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems-${{#mustacheCase}}hashFiles('**/Gemfile.lock'){{/mustacheCase}} + restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods-${{#mustacheCase}} hashFiles('**/Podfile.lock') {{/mustacheCase}} - restore-keys: ${{ runner.os }}-pods- + key: ${{#mustacheCase}}runner.os{{/mustacheCase}}-pods-${{#mustacheCase}}hashFiles('**/Podfile.lock'){{/mustacheCase}} + restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-pods- - name: Bundle install run: cd ./ios && bundle install diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml index 45edb3b9..3b9a98ba 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_testflight.yml @@ -43,7 +43,7 @@ jobs: - name: Set up Production env env: - ENV: ${{#mustacheCase}} secrets.ENV {{/mustacheCase}} + ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}} run: | echo -e "$ENV" >> .env @@ -55,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems-${{#mustacheCase}} hashFiles('**/Gemfile.lock') {{/mustacheCase}} - restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-gems- + key: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems-${{#mustacheCase}}hashFiles('**/Gemfile.lock'){{/mustacheCase}} + restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods-${{#mustacheCase}} hashFiles('**/Podfile.lock') {{/mustacheCase}} - restore-keys: ${{#mustacheCase}} runner.os {{/mustacheCase}}-pods- + key: ${{#mustacheCase}}runner.os{{/mustacheCase}}-pods-${{#mustacheCase}}hashFiles('**/Podfile.lock'){{/mustacheCase}} + restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-pods- - name: Bundle install run: cd ./ios && bundle install From 2e162e843149f4e4d76c13f8d6e0f9b4571a5b13 Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Wed, 6 Sep 2023 11:29:14 +0700 Subject: [PATCH 52/53] [#169] Format code --- .../.github/workflows/ios_deploy_to_app_store.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml index c6a3f0b5..73329426 100644 --- a/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml +++ b/bricks/template/__brick__/{{project_name.snakeCase()}}/.github/workflows/ios_deploy_to_app_store.yml @@ -56,7 +56,7 @@ jobs: with: path: ios/vendor/bundle key: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems-${{#mustacheCase}}hashFiles('**/Gemfile.lock'){{/mustacheCase}} - restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems- + restore-keys: ${{#mustacheCase}}runner.os{{/mustacheCase}}-gems- - name: Cache Pods uses: actions/cache@v3 From 5acbeaa6834b2e5d9788e98c31a4b716cbf396c3 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Wed, 6 Sep 2023 04:34:22 +0000 Subject: [PATCH 53/53] [Chore] Generate & update sample project --- sample/.github/workflows/ios_deploy_to_app_store.yml | 10 +++++----- sample/.github/workflows/ios_deploy_to_testflight.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sample/.github/workflows/ios_deploy_to_app_store.yml b/sample/.github/workflows/ios_deploy_to_app_store.yml index e54e3f8b..62eec025 100644 --- a/sample/.github/workflows/ios_deploy_to_app_store.yml +++ b/sample/.github/workflows/ios_deploy_to_app_store.yml @@ -43,7 +43,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env @@ -55,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: $-pods- + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - name: Bundle install run: cd ./ios && bundle install diff --git a/sample/.github/workflows/ios_deploy_to_testflight.yml b/sample/.github/workflows/ios_deploy_to_testflight.yml index 4c08e665..f0a7fdf8 100644 --- a/sample/.github/workflows/ios_deploy_to_testflight.yml +++ b/sample/.github/workflows/ios_deploy_to_testflight.yml @@ -43,7 +43,7 @@ jobs: - name: Set up Production env env: - ENV: ${{ secrets.ENV }} + ENV: ${{ secrets.ENV }} run: | echo -e "$ENV" >> .env @@ -55,16 +55,16 @@ jobs: id: bunlderCache with: path: ios/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: ${{ runner.os }}-gems- + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- - name: Cache Pods uses: actions/cache@v3 id: cocoapodCache with: path: ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: ${{ runner.os }}-pods- + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- - name: Bundle install run: cd ./ios && bundle install