From 0c46882e9323fe0e3ead651ddafb34bb22d0becc Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 6 Aug 2024 17:33:15 +0500 Subject: [PATCH] fixed version names --- .github/workflows/build-sample-apps.yml | 15 ++------------- apps/amiapp_flutter/fastlane/Fastfile | 15 ++++++++------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-sample-apps.yml b/.github/workflows/build-sample-apps.yml index b9b9dae..e944d68 100644 --- a/.github/workflows/build-sample-apps.yml +++ b/.github/workflows/build-sample-apps.yml @@ -56,34 +56,23 @@ jobs: working-directory: "apps/${{ matrix.sample-app }}" - name: Generate New Version - id: generate_version uses: maierj/fastlane-action@v3.1.0 with: + working-directory: "apps/${{ matrix.sample-app }}" lane: "generate_new_version" - options: | - branch_name=${{ github.ref_name }} - pull_request_number=${{ github.event.pull_request.number }} - env: - NEW_VERSION_NAME: ${{ steps.generate_version.outputs.NEW_VERSION_NAME }} - NEW_VERSION_CODE: ${{ steps.generate_version.outputs.NEW_VERSION_CODE }} + options: '{"branch_name":"${{ github.ref_name }}", "pull_request_number":"${{ github.event.pull_request.number }}"}' # - name: Update Flutter SDK Version # uses: maierj/fastlane-action@v3.1.0 # with: # lane: "update_flutter_sdk_version" # subdirectory: "apps/${{ matrix.sample-app }}" -# options: | -# version_name=${{ steps.generate_version.outputs.NEW_VERSION_NAME }} -# version_code=${{ steps.generate_version.outputs.NEW_VERSION_CODE }} # - name: Update Sample App Version uses: maierj/fastlane-action@v3.1.0 with: lane: "update_flutter_app_version" subdirectory: "apps/${{ matrix.sample-app }}" - options: | - version_name=${{ steps.generate_version.outputs.NEW_VERSION_NAME }} - version_code=${{ steps.generate_version.outputs.NEW_VERSION_CODE }} - name: Install flutter dependencies run: flutter pub get diff --git a/apps/amiapp_flutter/fastlane/Fastfile b/apps/amiapp_flutter/fastlane/Fastfile index 62660b6..524ca11 100644 --- a/apps/amiapp_flutter/fastlane/Fastfile +++ b/apps/amiapp_flutter/fastlane/Fastfile @@ -5,15 +5,17 @@ lane :generate_new_version do |options| commits_count = `git rev-list --count HEAD`.strip time_in_millis = (Time.now.to_f * 1000).to_i + sdk_version_name = "#{branch_name}.#{commits_count}.0" if pull_request_number new_version_name = "#{pull_request_number}.#{commits_count}.0" else - new_version_name = "#{branch_name}.#{commits_count}.0" + new_version_name = sdk_version_name end new_version_code = time_in_millis - ENV['NEW_VERSION_NAME'] = new_version_name - ENV['NEW_VERSION_CODE'] = new_version_code.to_s + ENV['SDK_VERSION_NAME'] = sdk_version_name + ENV['APP_VERSION_NAME'] = new_version_name + ENV['APP_VERSION_CODE'] = new_version_code.to_s UI.message("Generated new version name: #{new_version_name} and version code: #{new_version_code}") end @@ -75,8 +77,7 @@ end # Lane to update Flutter app version lane :update_flutter_sdk_version do |options| project_path = options[:project_path] || File.join(Dir.pwd, '../../..') - version_name = options[:version_name] - version_code = options[:version_code] + version_name = ENV['SDK_VERSION_NAME'] update_pubspec_version(project_path, version_name) end @@ -84,8 +85,8 @@ end # Lane to update Flutter app version lane :update_flutter_app_version do |options| project_path = options[:project_path] || File.join(Dir.pwd, '..') - version_name = options[:version_name] - version_code = options[:version_code] + version_name = ENV['APP_VERSION_NAME'] + version_code = ENV['APP_VERSION_CODE'] # To match version format with flutter apps e.g. 1.0.0+1 new_version = "#{version_name}+#{version_code}"