Skip to content

Commit

Permalink
Merge pull request #270 from nimblehq/chore/198-add-release-note-fire…
Browse files Browse the repository at this point in the history
…base-deploy

[#198] Generate and add "release notes" when distributing new builds on Firebase (staging and production)
  • Loading branch information
luongvo authored Nov 13, 2023
2 parents 8f16547 + 630cc79 commit c9f59c1
Show file tree
Hide file tree
Showing 16 changed files with 279 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/android_deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,24 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
releaseNotes: ${{ steps.changelog.outputs.changelog }}
file: build/app/outputs/flutter-apk/app-production-release.apk
21 changes: 21 additions & 0 deletions .github/workflows/android_deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,31 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
releaseNotes: ${{ steps.changelog.outputs.changelog }}
file: build/app/outputs/flutter-apk/app-staging-debug.apk
32 changes: 32 additions & 0 deletions .github/workflows/configs/changelog-config.json
Original file line number Diff line number Diff line change
@@ -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
}
22 changes: 22 additions & 0 deletions .github/workflows/ios_deploy_staging_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ jobs:
run: |
echo -e "$ENV" > .env.staging
- 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

Expand All @@ -65,5 +85,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
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,24 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
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.changelog.outputs.changelog{{/mustacheCase}}
file: build/app/outputs/flutter-apk/app-production-release.apk
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,31 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
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.changelog.outputs.changelog{{/mustacheCase}}
file: build/app/outputs/flutter-apk/app-staging-debug.apk
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ jobs:
run: |
echo -e "$ENV" > .env.staging
- 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

Expand All @@ -59,5 +79,7 @@ jobs:
run: cd ./ios && bundle exec fastlane sync_adhoc_staging_signing

- name: Deploy to Firebase
env:
RELEASE_NOTE_CONTENT:${{#mustacheCase}}steps.changelog.outputs.changelog{{/mustacheCase}}
run: |
cd ./ios && bundle exec fastlane build_and_upload_staging_app
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bricks/template/__brick__/ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions sample/.github/workflows/android_deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,24 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
releaseNotes: ${{ steps.changelog.outputs.changelog }}
file: build/app/outputs/flutter-apk/app-production-release.apk
21 changes: 21 additions & 0 deletions sample/.github/workflows/android_deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,31 @@ jobs:
- name: Build Android apk
run: flutter build apk --flavor staging --debug --build-number $GITHUB_RUN_NUMBER

- 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/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
releaseNotes: ${{ steps.changelog.outputs.changelog }}
file: build/app/outputs/flutter-apk/app-staging-debug.apk
32 changes: 32 additions & 0 deletions sample/.github/workflows/configs/changelog-config.json
Original file line number Diff line number Diff line change
@@ -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
}
22 changes: 22 additions & 0 deletions sample/.github/workflows/ios_deploy_staging_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ jobs:
run: |
echo -e "$ENV" > .env.staging
- 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

Expand All @@ -59,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
Loading

0 comments on commit c9f59c1

Please sign in to comment.