From e56cf48b9d595045d9a91bd17c6eaf371f98781a Mon Sep 17 00:00:00 2001 From: Christoph Aldrian Date: Fri, 29 Nov 2024 16:31:08 +0100 Subject: [PATCH 1/3] chore: write build number to summary --- .github/workflows/_reusable_app_release.yml | 1 + fastlane/Fastfile | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/_reusable_app_release.yml b/.github/workflows/_reusable_app_release.yml index 1794715c159..5a08a4f6b35 100644 --- a/.github/workflows/_reusable_app_release.yml +++ b/.github/workflows/_reusable_app_release.yml @@ -182,6 +182,7 @@ jobs: run: bundle exec fastlane ${{ inputs.fastlane_action }} env: HAS_PACKAGES_CACHE_HIT: ${{ steps.cache-swift-packages.outputs.cache-hit == 'true' }} + #GITHUB_STEP_SUMMARY: ${{ GITHUB_STEP_SUMMARY }} - name: Archiving Logs uses: actions/upload-artifact@v4 if: failure() diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1223a2f4e60..1403ca8b614 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -293,9 +293,26 @@ platform :ios do def generate_build_number build_number = `curl -H "Accept: text/plain" -X POST -d '' "https://incrementator.appspot.com/api/v1/code/ORUHILeMbXB4D5Z5conFzYoYpQPjVnyUA4pu56X2MHVJSFxM/increment"` `echo BUILD_NUMBER=#{build_number} >> ./.post_build/.env` + write_build_number_to_summary(build_number) build_number end + def write_build_number_to_summary(build_number) + summary_file = ENV['GITHUB_STEP_SUMMARY'] + + if summary_file.nil? || summary_file.empty? + UI.error("GITHUB_STEP_SUMMARY is not set. Are you running in GitHub Actions?") + return + end + + File.open(summary_file, "a") do |file| + file.puts "## Fastlane Summary" + file.puts "- 🛠️ Build Number: #{build_number}" + end + + UI.message("Successfully wrote to GITHUB_STEP_SUMMARY.") + end + # Fetch dependencies and prepare for building a release def prepare_for_release(options) xcode_version = options[:xcode_version] From 9bd8b096ba493447c6ddf1f1f714fae9e7369da9 Mon Sep 17 00:00:00 2001 From: Christoph Aldrian Date: Mon, 2 Dec 2024 10:22:58 +0100 Subject: [PATCH 2/3] remove commented line --- .github/workflows/_reusable_app_release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/_reusable_app_release.yml b/.github/workflows/_reusable_app_release.yml index 5a08a4f6b35..1794715c159 100644 --- a/.github/workflows/_reusable_app_release.yml +++ b/.github/workflows/_reusable_app_release.yml @@ -182,7 +182,6 @@ jobs: run: bundle exec fastlane ${{ inputs.fastlane_action }} env: HAS_PACKAGES_CACHE_HIT: ${{ steps.cache-swift-packages.outputs.cache-hit == 'true' }} - #GITHUB_STEP_SUMMARY: ${{ GITHUB_STEP_SUMMARY }} - name: Archiving Logs uses: actions/upload-artifact@v4 if: failure() From feb2a9d5d6d22e43cc8ce22fca2cef5954501ff7 Mon Sep 17 00:00:00 2001 From: Christoph Aldrian Date: Mon, 2 Dec 2024 10:24:54 +0100 Subject: [PATCH 3/3] full version --- fastlane/Fastfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1403ca8b614..9fee34fa8ee 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -293,11 +293,11 @@ platform :ios do def generate_build_number build_number = `curl -H "Accept: text/plain" -X POST -d '' "https://incrementator.appspot.com/api/v1/code/ORUHILeMbXB4D5Z5conFzYoYpQPjVnyUA4pu56X2MHVJSFxM/increment"` `echo BUILD_NUMBER=#{build_number} >> ./.post_build/.env` - write_build_number_to_summary(build_number) + write_extra_info_to_summary build_number end - def write_build_number_to_summary(build_number) + def write_extra_info_to_summary summary_file = ENV['GITHUB_STEP_SUMMARY'] if summary_file.nil? || summary_file.empty? @@ -307,7 +307,7 @@ platform :ios do File.open(summary_file, "a") do |file| file.puts "## Fastlane Summary" - file.puts "- 🛠️ Build Number: #{build_number}" + file.puts "- 🛠️ Version: '#{extra_info}'" end UI.message("Successfully wrote to GITHUB_STEP_SUMMARY.")