【发布时间】:2022-09-23 18:36:48
【问题描述】:
我已经在我的 iOS 颤振项目中实现了 fastlane 和 github 操作的配置,并带有一些用于增加版本和内部版本号的自定义操作。
default_platform(:ios)
DEVELOPER_APP_ID = ENV[\'DEVELOPER_APP_ID\']
DEVELOPER_APP_IDENTIFIER = ENV[\'DEVELOPER_APP_IDENTIFIER\']
PROVISIONING_PROFILE_SPECIFIER = ENV[\'PROVISIONING_PROFILE_SPECIFIER\']
TEMP_KEYCHAIN_USER = ENV[\'TEMP_KEYCHAIN_USER\']
TEMP_KEYCHAIN_PASSWORD = ENV[\'TEMP_KEYCHAIN_PASSWORD\']
Path = \'/Users/*********\'
def delete_temp_keychain(name)
if File.exist? File.expand_path(\"~/Library/Keychains/#{name}-db\")
delete_keychain(
name: name
)
end
end
def create_temp_keychain(name, password)
print(\'name\', name, \'password\', password)
create_keychain(
name: name,
password: password,
unlock: false,
timeout: 0
)
end
def ensure_temp_keychain(name, password)
delete_temp_keychain(name)
create_temp_keychain(name, password)
end
def update_version(type)
case type
when \'major\' then increment_version_number_in_xcodeproj(bump_type: \'major\')
when \'minor\' then increment_version_number_in_xcodeproj(bump_type: \'minor\')
when \'patch\' then increment_version_number_in_xcodeproj(bump_type: \'patch\')
else abort(\"Unknown version bump type: #{type}\\nValid options: major, minor, patch.\")
end
end
platform :ios do
lane :update_major do
update_version(\'major\')
increment_build_number
end
lane :update_minor do
update_version(\'minor\')
increment_build_number
end
lane :update_patch do
# update_patch(\'patch\')
# increment_build_number
script = \'perlscript.pl\'
latest
exec(\"/usr/bin/perl #{script}\")
# perl -i -pe \'s/^(version:\\s+\\d+\\.\\d+\\.\\d+\\+)(\\d+)$/$1.($2+1)/e\' /Users/*******/Dev/******/pubspec.yaml\")
end
lane :_release_candidate do
keychain_name = TEMP_KEYCHAIN_USER
keychain_password = TEMP_KEYCHAIN_PASSWORD
# ensure_temp_keychain(\'fastlane_keychain_login\', \'!QA#ED4rf\')
ensure_temp_keychain(keychain_name, keychain_password)
add_git_tag(
grouping: \'fastlane-builds\',
includes_lane: true,
prefix: \'v\',
build_number: get_build_number,
postfix: \"-RC#{get_build_number}\"
)
push_to_git_remote # this will git-push the above newly created local git-tag
# match(
# type: \'appstore\',
# app_identifier: \"#{DEVELOPER_APP_IDENTIFIER}\",
# git_basic_authorization: Base64.strict_encode64(ENV[\'GIT_AUTHORIZATION\']),
# readonly: true,
# keychain_name: keychain_name,
# keychain_password: keychain_password
# )
# gym(
# configuration: \'Release\',
# workspace: \'Runner.xcworkspace\',
# scheme: \'Runner\',
# export_method: \'app-store\',
# export_options: {
# provisioningProfiles: {
# DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER
# }
# }
# )
# pilot(
# apple_id: \"#{DEVELOPER_APP_ID}\",
# app_identifier: \"#{DEVELOPER_APP_IDENTIFIER}\",
# skip_waiting_for_build_processing: false,
# skip_submission: true,
# distribute_external: false,
# notify_external_testers: false,
# ipa: \'./Runner.ipa\'
# )
delete_temp_keychain(keychain_name)
end
end
如上面的 fastfile 所示,我什至尝试使用perl更新 pubspec 但我无法在递增后传递新值。
#!/bin/bash
# set -e
# Find and increment the version number.
perl -i -pe \'s/^(version:\\s+\\d+\\.\\d+\\.\\d+\\+)(\\d+)$/$1.($2+1)/e\' /Users/******/Dev/*******/pubspec.yaml
我在使用 fastlane 中的 increment_build_number 操作更新 xcode 中的递增数字时遇到问题,发布规范.yaml版本并将更改的文件从 github 操作同步到主存储库或我的本地存储库,因为增量是通过在 github 操作中运行通道发生的。
-
嗨,你知道了吗?你介意分享你的 Github Action
-
嗨,@Aristidios,实际上我还没有,但我很快就会继续工作。
-
@Aristidios,我在下面的答案中找到了一种方法!
标签: flutter github-actions fastlane