From ff16640c15c45254dd74f4690a7d220311f8ea5f Mon Sep 17 00:00:00 2001 From: Doan Dinh Date: Mon, 21 Aug 2023 14:06:10 +0700 Subject: [PATCH 1/3] [#198] Add release notes for Android staging/production and iOS staging --- .github/workflows/android_deploy_production.yml | 5 +++++ .github/workflows/android_deploy_staging.yml | 5 +++++ .github/workflows/ios_deploy_staging_to_firebase.yml | 6 ++++++ .../.github/workflows/android_deploy_production.yml | 5 +++++ .../.github/workflows/android_deploy_staging.yml | 5 +++++ .../workflows/ios_deploy_staging_to_firebase.yml | 6 ++++++ .../__brick__/ios/fastlane/Constants/Environments.rb | 6 +++++- bricks/template/__brick__/ios/fastlane/Fastfile | 2 +- .../.github/workflows/android_deploy_production.yml | 7 ++++++- sample/.github/workflows/android_deploy_staging.yml | 5 +++++ .../workflows/ios_deploy_staging_to_firebase.yml | 11 +++++++++++ sample/ios/fastlane/Constants/Environments.rb | 6 +++++- sample/ios/fastlane/Fastfile | 2 +- 13 files changed, 66 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android_deploy_production.yml b/.github/workflows/android_deploy_production.yml index 4c387402..aee293dd 100644 --- a/.github/workflows/android_deploy_production.yml +++ b/.github/workflows/android_deploy_production.yml @@ -57,10 +57,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} + releaseNotes: ${{ steps.PR.outputs.pr_body }} file: build/app/outputs/flutter-apk/app-production-release.apk diff --git a/.github/workflows/android_deploy_staging.yml b/.github/workflows/android_deploy_staging.yml index b6d3ad21..fbf23912 100644 --- a/.github/workflows/android_deploy_staging.yml +++ b/.github/workflows/android_deploy_staging.yml @@ -49,10 +49,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} + releaseNotes: ${{ steps.PR.outputs.pr_title }} 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 a3d1ae54..d3979421 100644 --- a/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -52,6 +52,10 @@ jobs: run: | echo -e "$ENV" > .env.staging + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs @@ -65,5 +69,7 @@ jobs: run: cd ./ios && bundle exec fastlane sync_adhoc_staging_signing - name: Deploy to Firebase + env: + RELEASE_NOTE_CONTENT: ${{ steps.PR.outputs.pr_title }} run: | cd ./ios && bundle exec fastlane build_and_upload_staging_app diff --git a/bricks/template/__brick__/.github/workflows/android_deploy_production.yml b/bricks/template/__brick__/.github/workflows/android_deploy_production.yml index d78f52b5..acdc5c3a 100644 --- a/bricks/template/__brick__/.github/workflows/android_deploy_production.yml +++ b/bricks/template/__brick__/.github/workflows/android_deploy_production.yml @@ -51,10 +51,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} + releaseNotes: ${{#mustacheCase}}steps.PR.outputs.pr_body{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-production-release.apk diff --git a/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml b/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml index 60ede1f1..7e9e7239 100644 --- a/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml +++ b/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml @@ -43,10 +43,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} + releaseNotes: ${{#mustacheCase}}steps.PR.outputs.pr_title{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml b/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml index bb9e3523..dead1d2f 100644 --- a/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -46,6 +46,10 @@ jobs: run: | echo -e "$ENV" > .env.staging + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs @@ -59,5 +63,7 @@ jobs: run: cd ./ios && bundle exec fastlane sync_adhoc_staging_signing - name: Deploy to Firebase + env: + RELEASE_NOTE_CONTENT: ${{ steps.PR.outputs.pr_title }} run: | cd ./ios && bundle exec fastlane build_and_upload_staging_app diff --git a/bricks/template/__brick__/ios/fastlane/Constants/Environments.rb b/bricks/template/__brick__/ios/fastlane/Constants/Environments.rb index 2900ccd5..4ebed9a1 100644 --- a/bricks/template/__brick__/ios/fastlane/Constants/Environments.rb +++ b/bricks/template/__brick__/ios/fastlane/Constants/Environments.rb @@ -44,6 +44,10 @@ def self.FIREBASE_TESTER_GROUPS end def self.GITHUB_RUN_NUMBER - ENV["GITHUB_RUN_NUMBER"] + ENV['GITHUB_RUN_NUMBER'] + end + + def self.RELEASE_NOTE_CONTENT + ENV['RELEASE_NOTE_CONTENT'] end end diff --git a/bricks/template/__brick__/ios/fastlane/Fastfile b/bricks/template/__brick__/ios/fastlane/Fastfile index 71bf3415..62aa7940 100644 --- a/bricks/template/__brick__/ios/fastlane/Fastfile +++ b/bricks/template/__brick__/ios/fastlane/Fastfile @@ -211,7 +211,7 @@ platform :ios do product_name: options[:product_name], firebase_app_id: options[:firebase_app_id], tester_groups: options[:tester_groups], - notes: "" + notes: Environments.RELEASE_NOTE_CONTENT ) end end diff --git a/sample/.github/workflows/android_deploy_production.yml b/sample/.github/workflows/android_deploy_production.yml index 700abdd8..27762840 100644 --- a/sample/.github/workflows/android_deploy_production.yml +++ b/sample/.github/workflows/android_deploy_production.yml @@ -51,10 +51,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: 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-release.apk + releaseNotes: ${{ steps.PR.outputs.pr_body }} + file: build/app/outputs/flutter-apk/app-production-debug.apk diff --git a/sample/.github/workflows/android_deploy_staging.yml b/sample/.github/workflows/android_deploy_staging.yml index 6120d5ac..e7405416 100644 --- a/sample/.github/workflows/android_deploy_staging.yml +++ b/sample/.github/workflows/android_deploy_staging.yml @@ -43,10 +43,15 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 with: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} + releaseNotes: ${{ steps.PR.outputs.pr_title }} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml index a20c1d66..fd67e681 100644 --- a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -46,6 +46,17 @@ jobs: run: | echo -e "$ENV" > .env.staging + - name: Get PR information + uses: 8BitJonny/gh-get-current-pr@2.2.0 + id: PR + + - name: Generate release notes + id: generate-release-notes + env: + PR_TITLE: ${{ steps.PR.outputs.pr_title }} + run: | + echo "RELEASE_NOTE_CONTENT=$PR_TITLE" >> $GITHUB_ENV + - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/sample/ios/fastlane/Constants/Environments.rb b/sample/ios/fastlane/Constants/Environments.rb index 2900ccd5..4ebed9a1 100644 --- a/sample/ios/fastlane/Constants/Environments.rb +++ b/sample/ios/fastlane/Constants/Environments.rb @@ -44,6 +44,10 @@ def self.FIREBASE_TESTER_GROUPS end def self.GITHUB_RUN_NUMBER - ENV["GITHUB_RUN_NUMBER"] + ENV['GITHUB_RUN_NUMBER'] + end + + def self.RELEASE_NOTE_CONTENT + ENV['RELEASE_NOTE_CONTENT'] end end diff --git a/sample/ios/fastlane/Fastfile b/sample/ios/fastlane/Fastfile index 71bf3415..62aa7940 100644 --- a/sample/ios/fastlane/Fastfile +++ b/sample/ios/fastlane/Fastfile @@ -211,7 +211,7 @@ platform :ios do product_name: options[:product_name], firebase_app_id: options[:firebase_app_id], tester_groups: options[:tester_groups], - notes: "" + notes: Environments.RELEASE_NOTE_CONTENT ) end end From 423b3f1347208f42a3c50d37a021a4b6bea32323 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Fri, 3 Nov 2023 04:11:59 +0000 Subject: [PATCH 2/3] [#198] Update change log config path --- .../workflows/android_deploy_production.yml | 17 +++++++--- .github/workflows/android_deploy_staging.yml | 24 +++++++++++--- .../workflows/configs/changelog-config.json | 32 +++++++++++++++++++ .../ios_deploy_staging_to_firebase.yml | 24 +++++++++++--- .../workflows/android_deploy_production.yml | 17 +++++++--- .../workflows/android_deploy_staging.yml | 24 +++++++++++--- .../workflows/configs/changelog-config.json | 32 +++++++++++++++++++ .../ios_deploy_staging_to_firebase.yml | 24 +++++++++++--- .../workflows/android_deploy_production.yml | 19 ++++++++--- .../workflows/android_deploy_staging.yml | 24 +++++++++++--- .../workflows/configs/changelog-config.json | 32 +++++++++++++++++++ .../ios_deploy_staging_to_firebase.yml | 29 +++++++++++------ 12 files changed, 256 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/configs/changelog-config.json create mode 100644 bricks/template/__brick__/.github/workflows/configs/changelog-config.json create mode 100644 sample/.github/workflows/configs/changelog-config.json diff --git a/.github/workflows/android_deploy_production.yml b/.github/workflows/android_deploy_production.yml index aee293dd..ce95dfc9 100644 --- a/.github/workflows/android_deploy_production.yml +++ b/.github/workflows/android_deploy_production.yml @@ -57,9 +57,18 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Build changelog on "main" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -67,5 +76,5 @@ jobs: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} - releaseNotes: ${{ steps.PR.outputs.pr_body }} + releaseNotes: ${{ steps.changelog.outputs.changelog }} file: build/app/outputs/flutter-apk/app-production-release.apk diff --git a/.github/workflows/android_deploy_staging.yml b/.github/workflows/android_deploy_staging.yml index fbf23912..3a43f200 100644 --- a/.github/workflows/android_deploy_staging.yml +++ b/.github/workflows/android_deploy_staging.yml @@ -49,9 +49,25 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/configs/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -59,5 +75,5 @@ jobs: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} - releaseNotes: ${{ steps.PR.outputs.pr_title }} + releaseNotes: ${{ steps.changelog.outputs.changelog }} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/.github/workflows/configs/changelog-config.json b/.github/workflows/configs/changelog-config.json new file mode 100644 index 00000000..c795bff1 --- /dev/null +++ b/.github/workflows/configs/changelog-config.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type : feature" + ] + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type : bug" + ] + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type : chore" + ] + }, + { + "title": "## Others", + "exclude_labels": [ + "type : feature", + "type : bug", + "type : chore", + "type : release" + ] + } + ], + "max_pull_requests": 200 +} diff --git a/.github/workflows/ios_deploy_staging_to_firebase.yml b/.github/workflows/ios_deploy_staging_to_firebase.yml index d3979421..658543c9 100644 --- a/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -52,9 +52,25 @@ jobs: run: | echo -e "$ENV" > .env.staging - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/configs/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs @@ -70,6 +86,6 @@ jobs: - name: Deploy to Firebase env: - RELEASE_NOTE_CONTENT: ${{ steps.PR.outputs.pr_title }} + RELEASE_NOTE_CONTENT: ${{ steps.changelog.outputs.changelog }} run: | cd ./ios && bundle exec fastlane build_and_upload_staging_app diff --git a/bricks/template/__brick__/.github/workflows/android_deploy_production.yml b/bricks/template/__brick__/.github/workflows/android_deploy_production.yml index acdc5c3a..8aa9798b 100644 --- a/bricks/template/__brick__/.github/workflows/android_deploy_production.yml +++ b/bricks/template/__brick__/.github/workflows/android_deploy_production.yml @@ -51,9 +51,18 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Build changelog on "main" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{#mustacheCase}}steps.head.outputs.sha{{/mustacheCase}} + token: ${{#mustacheCase}}secrets.GITHUB_TOKEN{{/mustacheCase}} - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -61,5 +70,5 @@ jobs: appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} - releaseNotes: ${{#mustacheCase}}steps.PR.outputs.pr_body{{/mustacheCase}} + releaseNotes: ${{#mustacheCase}}steps.changelog.outputs.changelog{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-production-release.apk diff --git a/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml b/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml index 7e9e7239..2b273d8e 100644 --- a/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml +++ b/bricks/template/__brick__/.github/workflows/android_deploy_staging.yml @@ -43,9 +43,25 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/configs/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{#mustacheCase}}steps.head.outputs.sha{{/mustacheCase}} + token: ${{#mustacheCase}}secrets.GITHUB_TOKEN{{/mustacheCase}} - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -53,5 +69,5 @@ jobs: appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}} serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}} groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}} - releaseNotes: ${{#mustacheCase}}steps.PR.outputs.pr_title{{/mustacheCase}} + releaseNotes: ${{#mustacheCase}}steps.changelog.outputs.changelog{{/mustacheCase}} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/bricks/template/__brick__/.github/workflows/configs/changelog-config.json b/bricks/template/__brick__/.github/workflows/configs/changelog-config.json new file mode 100644 index 00000000..c795bff1 --- /dev/null +++ b/bricks/template/__brick__/.github/workflows/configs/changelog-config.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type : feature" + ] + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type : bug" + ] + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type : chore" + ] + }, + { + "title": "## Others", + "exclude_labels": [ + "type : feature", + "type : bug", + "type : chore", + "type : release" + ] + } + ], + "max_pull_requests": 200 +} diff --git a/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml b/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml index dead1d2f..f16326ed 100644 --- a/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/bricks/template/__brick__/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -46,9 +46,25 @@ jobs: run: | echo -e "$ENV" > .env.staging - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/configs/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{#mustacheCase}}steps.head.outputs.sha{{/mustacheCase}} + token: ${{#mustacheCase}}secrets.GITHUB_TOKEN{{/mustacheCase}} - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs @@ -64,6 +80,6 @@ jobs: - name: Deploy to Firebase env: - RELEASE_NOTE_CONTENT: ${{ steps.PR.outputs.pr_title }} + RELEASE_NOTE_CONTENT:${{#mustacheCase}}steps.changelog.outputs.changelog{{/mustacheCase}} run: | cd ./ios && bundle exec fastlane build_and_upload_staging_app diff --git a/sample/.github/workflows/android_deploy_production.yml b/sample/.github/workflows/android_deploy_production.yml index 27762840..767b9dc3 100644 --- a/sample/.github/workflows/android_deploy_production.yml +++ b/sample/.github/workflows/android_deploy_production.yml @@ -51,9 +51,18 @@ jobs: - name: Build Android apk run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Build changelog on "main" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Android Production to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -61,5 +70,5 @@ jobs: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} - releaseNotes: ${{ steps.PR.outputs.pr_body }} - file: build/app/outputs/flutter-apk/app-production-debug.apk + releaseNotes: ${{ steps.changelog.outputs.changelog }} + file: build/app/outputs/flutter-apk/app-production-release.apk diff --git a/sample/.github/workflows/android_deploy_staging.yml b/sample/.github/workflows/android_deploy_staging.yml index e7405416..9969ed7c 100644 --- a/sample/.github/workflows/android_deploy_staging.yml +++ b/sample/.github/workflows/android_deploy_staging.yml @@ -43,9 +43,25 @@ jobs: - name: Build Android apk run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Android Staging to Firebase uses: wzieba/Firebase-Distribution-Github-Action@v1.5.0 @@ -53,5 +69,5 @@ jobs: appId: ${{ vars.FIREBASE_ANDROID_APP_ID }} serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }} groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }} - releaseNotes: ${{ steps.PR.outputs.pr_title }} + releaseNotes: ${{ steps.changelog.outputs.changelog }} file: build/app/outputs/flutter-apk/app-staging-debug.apk diff --git a/sample/.github/workflows/configs/changelog-config.json b/sample/.github/workflows/configs/changelog-config.json new file mode 100644 index 00000000..c795bff1 --- /dev/null +++ b/sample/.github/workflows/configs/changelog-config.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type : feature" + ] + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type : bug" + ] + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type : chore" + ] + }, + { + "title": "## Others", + "exclude_labels": [ + "type : feature", + "type : bug", + "type : chore", + "type : release" + ] + } + ], + "max_pull_requests": 200 +} diff --git a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml index fd67e681..5f409a3c 100644 --- a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -46,16 +46,25 @@ jobs: run: | echo -e "$ENV" > .env.staging - - name: Get PR information - uses: 8BitJonny/gh-get-current-pr@2.2.0 - id: PR + - name: Find HEAD commit + id: head + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Generate release notes - id: generate-release-notes - env: - PR_TITLE: ${{ steps.PR.outputs.pr_title }} - run: | - echo "RELEASE_NOTE_CONTENT=$PR_TITLE" >> $GITHUB_ENV + - name: Limit changelog to the latest pull request only + uses: jossef/action-set-json-field@v2 + with: + file: .github/workflows/changelog-config.json + field: max_pull_requests + value: 1 + + - name: Build changelog on "develop" + id: changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: ".github/workflows/configs/changelog-config.json" + # Listing PRs from the last tag to the HEAD commit + toTag: ${{ steps.head.outputs.sha }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Run code generator run: flutter packages pub run build_runner build --delete-conflicting-outputs @@ -70,5 +79,7 @@ jobs: run: cd ./ios && bundle exec fastlane sync_adhoc_staging_signing - name: Deploy to Firebase + env: + RELEASE_NOTE_CONTENT:${{ steps.changelog.outputs.changelog }} run: | cd ./ios && bundle exec fastlane build_and_upload_staging_app From 630cc7909209fe407c33ce2b4acf9fed49560892 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Fri, 10 Nov 2023 07:23:18 +0000 Subject: [PATCH 3/3] [Chore] Generate & update sample project --- sample/.github/workflows/android_deploy_staging.yml | 2 +- sample/.github/workflows/ios_deploy_staging_to_firebase.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/.github/workflows/android_deploy_staging.yml b/sample/.github/workflows/android_deploy_staging.yml index 9969ed7c..e20a4255 100644 --- a/sample/.github/workflows/android_deploy_staging.yml +++ b/sample/.github/workflows/android_deploy_staging.yml @@ -50,7 +50,7 @@ jobs: - name: Limit changelog to the latest pull request only uses: jossef/action-set-json-field@v2 with: - file: .github/workflows/changelog-config.json + file: .github/workflows/configs/changelog-config.json field: max_pull_requests value: 1 diff --git a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml index 5f409a3c..8e5fa634 100644 --- a/sample/.github/workflows/ios_deploy_staging_to_firebase.yml +++ b/sample/.github/workflows/ios_deploy_staging_to_firebase.yml @@ -53,7 +53,7 @@ jobs: - name: Limit changelog to the latest pull request only uses: jossef/action-set-json-field@v2 with: - file: .github/workflows/changelog-config.json + file: .github/workflows/configs/changelog-config.json field: max_pull_requests value: 1