mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Tag nightlies after a successful build (#871)
* Tag nightlies after a successful build * Tweaks and fixes after code review
This commit is contained in:
parent
b83e8a5bcc
commit
a762fdbc69
@ -9,6 +9,8 @@ if [ "$CI_WORKFLOW" = "Release" ]; then
|
||||
|
||||
bundle exec fastlane release_to_github
|
||||
bundle exec fastlane prepare_next_release
|
||||
elif [ "$CI_WORKFLOW" = "Nightly" ]; then
|
||||
bundle exec fastlane tag_nightly build_number:"$CI_BUILD_NUMBER"
|
||||
fi
|
||||
|
||||
# Upload dsyms no matter the workflow
|
||||
|
@ -222,9 +222,6 @@ lane :release_to_github do
|
||||
end
|
||||
|
||||
lane :prepare_next_release do
|
||||
api_token = ENV["GITHUB_TOKEN"]
|
||||
UI.user_error!("Invalid GitHub API token.") unless !api_token.to_s.empty?
|
||||
|
||||
target_file_path = "../project.yml"
|
||||
xcode_project_file_path = "../ElementX.xcodeproj"
|
||||
|
||||
@ -238,17 +235,52 @@ lane :prepare_next_release do
|
||||
|
||||
xcodegen(spec: "project.yml")
|
||||
|
||||
sh("git config --global user.name 'Element CI'")
|
||||
sh("git config --global user.email 'ci@element.io'")
|
||||
setup_git()
|
||||
|
||||
sh("git add #{target_file_path} #{xcode_project_file_path}")
|
||||
|
||||
sh("git commit -m 'Prepare next release'")
|
||||
|
||||
# Get repo url path, without `http` or `git@` prefixes
|
||||
repo_url = sh("git ls-remote --get-url origin | sed 's#http://##g' | sed 's#https:\/\/##g' | sed 's#git@##g\'")
|
||||
git_push()
|
||||
end
|
||||
|
||||
lane :tag_nightly do |options|
|
||||
build_number = options[:build_number]
|
||||
UI.user_error!("Invalid build number.") unless !build_number.to_s.empty?
|
||||
|
||||
xcodegen_project_file_path = "../project.yml"
|
||||
data = YAML.load_file xcodegen_project_file_path
|
||||
current_version = data["settings"]["MARKETING_VERSION"]
|
||||
|
||||
setup_git()
|
||||
|
||||
tag_name = "nightly/#{current_version}.#{build_number}"
|
||||
sh("git tag #{tag_name}")
|
||||
|
||||
git_push(tag_name: tag_name)
|
||||
end
|
||||
|
||||
private_lane :setup_git
|
||||
sh("git config --global user.name 'Element CI'")
|
||||
sh("git config --global user.email 'ci@element.io'")
|
||||
end
|
||||
|
||||
private_lane :git_push do |options|
|
||||
# Use the Github API token for repo write access
|
||||
api_token = ENV["GITHUB_TOKEN"]
|
||||
UI.user_error!("Invalid GitHub API token.") unless !api_token.to_s.empty?
|
||||
|
||||
# Get repo url path, without `http`, `https` or `git@` prefixes or `.git` suffix
|
||||
repo_url = sh("git ls-remote --get-url origin | sed 's#http://##g' | sed 's#https:\/\/##g' | sed 's#git@##g' | sed 's#.git##g'")
|
||||
|
||||
# This sometimes has a trailing newline
|
||||
repo_url = repo_url.strip
|
||||
|
||||
# Push the tag separately if available
|
||||
if options[:tag_name]
|
||||
sh("git push https://#{api_token}@#{repo_url} #{options[:tag_name]}")
|
||||
end
|
||||
|
||||
# Use the access token for write access
|
||||
sh("git push https://#{api_token}@#{repo_url}")
|
||||
end
|
||||
|
||||
|
@ -93,6 +93,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
|
||||
|
||||
|
||||
|
||||
### tag_nightly
|
||||
|
||||
```sh
|
||||
[bundle exec] fastlane tag_nightly
|
||||
```
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
|
||||
|
Loading…
x
Reference in New Issue
Block a user