From 423b3f1347208f42a3c50d37a021a4b6bea32323 Mon Sep 17 00:00:00 2001 From: team-nimblehq Date: Fri, 3 Nov 2023 04:11:59 +0000 Subject: [PATCH] [#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