mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20: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:
@@ -9,6 +9,8 @@ if [ "$CI_WORKFLOW" = "Release" ]; then
|
|||||||
|
|
||||||
bundle exec fastlane release_to_github
|
bundle exec fastlane release_to_github
|
||||||
bundle exec fastlane prepare_next_release
|
bundle exec fastlane prepare_next_release
|
||||||
|
elif [ "$CI_WORKFLOW" = "Nightly" ]; then
|
||||||
|
bundle exec fastlane tag_nightly build_number:"$CI_BUILD_NUMBER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Upload dsyms no matter the workflow
|
# Upload dsyms no matter the workflow
|
||||||
|
|||||||
+40
-8
@@ -222,9 +222,6 @@ lane :release_to_github do
|
|||||||
end
|
end
|
||||||
|
|
||||||
lane :prepare_next_release do
|
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"
|
target_file_path = "../project.yml"
|
||||||
xcode_project_file_path = "../ElementX.xcodeproj"
|
xcode_project_file_path = "../ElementX.xcodeproj"
|
||||||
|
|
||||||
@@ -238,17 +235,52 @@ lane :prepare_next_release do
|
|||||||
|
|
||||||
xcodegen(spec: "project.yml")
|
xcodegen(spec: "project.yml")
|
||||||
|
|
||||||
sh("git config --global user.name 'Element CI'")
|
setup_git()
|
||||||
sh("git config --global user.email 'ci@element.io'")
|
|
||||||
|
|
||||||
sh("git add #{target_file_path} #{xcode_project_file_path}")
|
sh("git add #{target_file_path} #{xcode_project_file_path}")
|
||||||
|
|
||||||
sh("git commit -m 'Prepare next release'")
|
sh("git commit -m 'Prepare next release'")
|
||||||
|
|
||||||
# Get repo url path, without `http` or `git@` prefixes
|
git_push()
|
||||||
repo_url = sh("git ls-remote --get-url origin | sed 's#http://##g' | sed 's#https:\/\/##g' | sed 's#git@##g\'")
|
end
|
||||||
|
|
||||||
# Use the access token for write access
|
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
|
||||||
|
|
||||||
sh("git push https://#{api_token}@#{repo_url}")
|
sh("git push https://#{api_token}@#{repo_url}")
|
||||||
end
|
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.
|
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
|
||||||
|
|||||||
Reference in New Issue
Block a user