diff --git a/.github/actions/upload-android/action.yml b/.github/actions/upload-android/action.yml index 7f1fb418089..0452a2832b7 100644 --- a/.github/actions/upload-android/action.yml +++ b/.github/actions/upload-android/action.yml @@ -53,6 +53,33 @@ runs: echo "${{ inputs.FASTLANE_GOOGLE_SERVICE_ACCOUNT }}" | base64 --decode > service_account.json shell: bash + - uses: actions/download-artifact@v4 + if: ${{ inputs.trigger == 'develop' }} + with: + name: release-changelog + path: . + + - name: Prepare Play Store changelog metadata + if: ${{ inputs.trigger == 'develop' }} + run: | + mkdir -p android/fastlane/metadata/android/en-US/changelogs + + if [ -f changelog.txt ]; then + char_count=$(wc -m < changelog.txt) + + if [ "$char_count" -gt 500 ]; then + cut -c1-497 changelog.txt > "android/fastlane/metadata/android/en-US/changelogs/${BUILD_VERSION}.txt" + printf "..." >> "android/fastlane/metadata/android/en-US/changelogs/${BUILD_VERSION}.txt" + else + cat changelog.txt > "android/fastlane/metadata/android/en-US/changelogs/${BUILD_VERSION}.txt" + fi + else + printf "Internal improvements and bug fixes" > "android/fastlane/metadata/android/en-US/changelogs/${BUILD_VERSION}.txt" + fi + shell: bash + env: + BUILD_VERSION: ${{ inputs.BUILD_VERSION }} + - name: Fastlane Play Store Upload working-directory: android run: | @@ -65,7 +92,6 @@ runs: if [[ ${{ inputs.trigger }} == "develop" ]] && [[ ${{ inputs.type }} == 'official' ]]; then bundle exec fastlane android official_open_testing fi - shell: bash - name: Leave a comment on PR diff --git a/.github/actions/upload-ios/action.yml b/.github/actions/upload-ios/action.yml index 68f5d4539d4..4deefc781a2 100644 --- a/.github/actions/upload-ios/action.yml +++ b/.github/actions/upload-ios/action.yml @@ -109,6 +109,12 @@ runs: yarn pod-install shell: bash + - uses: actions/download-artifact@v4 + if: ${{ inputs.type == 'official' && inputs.trigger == 'develop' }} + with: + name: release-changelog + path: . + - name: Fastlane Submit to TestFlight working-directory: ios run: | @@ -157,4 +163,4 @@ runs: message="**iOS Build Available**"$'\n\n'"$app_name $VERSION_NAME.$BUILD_VERSION" gh pr comment "$PR_NUMBER" --body "$message" - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 48ffc62e564..b8be5d7ef33 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -14,11 +14,16 @@ jobs: if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }} uses: ./.github/workflows/eslint.yml + generate-changelog: + name: Generate Release Changelog + needs: [run-eslint-and-test] + uses: ./.github/workflows/generate-changelog.yml + android-build-experimental-store: name: Build Android Experimental if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }} uses: ./.github/workflows/build-android.yml - needs: [run-eslint-and-test] + needs: [run-eslint-and-test, generate-changelog] secrets: inherit with: type: experimental @@ -28,7 +33,7 @@ jobs: name: Build Android Official if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }} uses: ./.github/workflows/build-official-android.yml - needs: [run-eslint-and-test] + needs: [run-eslint-and-test, generate-changelog] secrets: inherit with: type: official @@ -38,7 +43,7 @@ jobs: name: Build iOS Experimental if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }} uses: ./.github/workflows/build-ios.yml - needs: [run-eslint-and-test] + needs: [run-eslint-and-test, generate-changelog] secrets: inherit with: type: experimental @@ -48,7 +53,7 @@ jobs: name: Build iOS Official if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }} uses: ./.github/workflows/build-official-ios.yml - needs: [run-eslint-and-test] + needs: [run-eslint-and-test, generate-changelog] secrets: inherit with: type: official diff --git a/.github/workflows/build-official-android.yml b/.github/workflows/build-official-android.yml index 76d195085b0..226c50ff26a 100644 --- a/.github/workflows/build-official-android.yml +++ b/.github/workflows/build-official-android.yml @@ -72,7 +72,7 @@ jobs: upload-android: name: Upload runs-on: ubuntu-latest - needs: [upload-hold] + needs: [build-android, upload-hold] if: ${{ inputs.type == 'official' && (always() && (needs.upload-hold.result == 'success' || needs.upload-hold.result == 'skipped')) }} steps: - name: Checkout Repository @@ -85,7 +85,7 @@ jobs: trigger: ${{ inputs.trigger }} FASTLANE_GOOGLE_SERVICE_ACCOUNT: ${{ secrets.FASTLANE_GOOGLE_SERVICE_ACCOUNT }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BUILD_VERSION: ${{ needs.upload-hold.outputs.BUILD_VERSION }} + BUILD_VERSION: ${{ needs.build-android.outputs.BUILD_VERSION }} upload-internal: name: Internal Sharing diff --git a/.github/workflows/generate-changelog.yml b/.github/workflows/generate-changelog.yml new file mode 100644 index 00000000000..af729951373 --- /dev/null +++ b/.github/workflows/generate-changelog.yml @@ -0,0 +1,38 @@ +name: Generate Release Changelog + +on: + workflow_call: + +jobs: + generate-changelog: + name: Generate changelog + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate changelog + shell: bash + run: | + LATEST_RELEASE_TAG=$(git tag --sort=-creatordate | head -n 1) + + if [ -z "$LATEST_RELEASE_TAG" ]; then + echo "- Improvements and bug fixes" > changelog.txt + exit 0 + fi + + git log "$LATEST_RELEASE_TAG"..HEAD --pretty=format:"- %s" --no-merges > changelog.txt + + if [ ! -s changelog.txt ]; then + echo "- Improvements and bug fixes" > changelog.txt + fi + + - name: Upload changelog artifact + uses: actions/upload-artifact@v4 + with: + name: release-changelog + path: changelog.txt + retention-days: 15 diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index b89435389ce..1448a1173f0 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -78,7 +78,11 @@ platform :android do upload_to_play_store( package_name: 'chat.rocket.android', track: 'beta', - aab: 'app/build/outputs/bundle/officialRelease/app-official-release.aab' + aab: 'app/build/outputs/bundle/officialRelease/app-official-release.aab', + skip_upload_metadata: true, + skip_upload_changelogs: false, + skip_upload_images: true, + skip_upload_screenshots: true ) end end diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 80a43c7f587..6f52b0e2f6b 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -29,17 +29,35 @@ platform :ios do desc "Submit a new Beta Build to Apple TestFlight" lane :beta do |options| + changelog_path = File.expand_path('../../changelog.txt', __dir__) + + changelog = if File.exist?(changelog_path) + content = File.read(changelog_path) + content.length > 4000 ? content[0, 3997] + "..." : content + end + api_key = app_store_connect_api_key( key_id: ENV["APP_STORE_CONNECT_API_KEY_ID"], issuer_id: ENV["APP_STORE_CONNECT_API_KEY_ISSUER_ID"], key_filepath: 'fastlane/app_store_connect_api_key.p8', in_house: false ) - pilot( - ipa: 'Rocket.Chat.ipa', - app_identifier: options[:official] ? 'chat.rocket.ios' : 'chat.rocket.reactnative', - skip_waiting_for_build_processing: true - ) + + pilot_options = { + ipa: 'Rocket.Chat.ipa', + app_identifier: options[:official] ? 'chat.rocket.ios' : 'chat.rocket.reactnative', + skip_waiting_for_build_processing: !(options[:official] && changelog), + reject_build_waiting_for_review: true, + } + + if options[:official] && changelog + pilot_options[:changelog] = changelog + pilot_options[:distribute_external] = true + pilot_options[:notify_external_testers] = true + pilot_options[:groups] = ["External Testers"] + end + + pilot(pilot_options) upload_symbols_to_crashlytics(dsym_path: "Rocket.Chat.app.dSYM.zip") upload_symbols_to_bugsnag( config_file: "RocketChatRN/Info.plist",