|
45 | 45 | desc "Available options: type:major|minor|patch" |
46 | 46 | lane :deploy do |options| |
47 | 47 |
|
48 | | - branch = options[:branch] || "master" |
49 | | - prepare_git(branch) |
| 48 | + repository_name = "algolia/algoliasearch-client-swift" |
| 49 | + podspec_path = "AlgoliaSearchClient.podspec" |
| 50 | + base_branch = options[:branch] || "master" |
50 | 51 |
|
51 | | - pod_lib_lint( |
52 | | - verbose: true, |
53 | | - allow_warnings: true |
| 52 | + ensure_git_branch( |
| 53 | + branch: base_branch |
54 | 54 | ) |
| 55 | + ensure_git_status_clean |
55 | 56 |
|
56 | | - new_build_number = version_bump_podspec( |
57 | | - bump_type: options[:type], |
58 | | - path: "AlgoliaSearchClient.podspec" |
| 57 | + release_type = options[:type] |
| 58 | + |
| 59 | + new_version = version_bump_podspec( |
| 60 | + bump_type: release_type, |
| 61 | + path: podspec_path |
59 | 62 | ) |
60 | 63 |
|
61 | | - sh("cd ..; ./generate_version #{new_build_number}") |
| 64 | + sh("cd ..; ./generate_changelog #{new_version}") |
| 65 | + sh("cd ..; ./generate_version #{new_version}") |
62 | 66 |
|
63 | | - branchName = "version-#{new_build_number}" |
64 | | - sh("git checkout -b #{branchName}") |
| 67 | + branch_name = "version-#{new_version}" |
| 68 | + sh("git checkout -b #{branch_name}") |
65 | 69 |
|
66 | | - #puts changelog_from_git_commits |
67 | 70 | git_commit( |
68 | | - path: ["AlgoliaSearchClient.podspec", "./Sources/AlgoliaSearchClient/Helpers/Version+Current.swift"], |
69 | | - message: "Version #{new_build_number}" |
| 71 | + path: [podspec_path, "./Sources/AlgoliaSearchClient/Helpers/Version+Current.swift", "CHANGELOG.md"], |
| 72 | + message: "chore: update version to #{new_version} [skip ci]" |
70 | 73 | ) |
71 | 74 | add_git_tag( |
72 | | - build_number: new_build_number, |
73 | | - tag: new_build_number |
| 75 | + build_number: new_version, |
| 76 | + tag: new_version |
74 | 77 | ) |
75 | 78 | push_to_git_remote(remote: "origin") |
76 | 79 |
|
77 | 80 | create_pull_request( |
78 | | - # api_token: "secret", # optional, defaults to ENV["GITHUB_API_TOKEN"] |
79 | | - repo: "algolia/algoliasearch-client-swift", |
80 | | - title: "Deploying new #{options[:type]} version #{new_build_number}", |
81 | | - head: "#{branchName}", # optional, defaults to current branch name |
82 | | - base: "master", # optional, defaults to "master" |
83 | | - body: "Please check the files before merging in case I've overidden something accidentally.", # optional |
84 | | - # api_url: "http://yourdomain/api/v3" # optional, for GitHub Enterprise, defaults to "https://api.github.com" |
| 81 | + repo: repository_name, |
| 82 | + title: "chore: Deploying new #{release_type} version #{new_version}", |
| 83 | + head: branch_name, |
| 84 | + base: base_branch, |
| 85 | + body: "Please check the files before merging in case I've overidden something accidentally." |
| 86 | + ) |
| 87 | + |
| 88 | + set_github_release( |
| 89 | + repository_name: repository_name, |
| 90 | + api_token: ENV["GITHUB_API_TOKEN"], |
| 91 | + name: new_version, |
| 92 | + tag_name: new_version, |
| 93 | + description: (File.read("../release_notes.md") rescue "No release notes provided"), |
| 94 | + is_draft: true, |
| 95 | + commitish: base_branch, |
| 96 | + upload_assets: [] |
85 | 97 | ) |
86 | 98 |
|
| 99 | + # Remove deployment trigger tag if needed |
| 100 | + if git_tag_exists(tag: "#{release_type}") |
| 101 | + sh("git tag -d #{release_type}; git push --delete origin #{release_type}") |
| 102 | + end |
| 103 | + |
87 | 104 | pod_push( |
88 | | - path: "AlgoliaSearchClient.podspec", |
| 105 | + path: podspec_path, |
89 | 106 | allow_warnings: true |
90 | 107 | ) |
91 | | - # This is failing when no files are changed. So we added this step in Bitrise instead along with is_skippable: true. |
92 | | - # |
93 | | - # deploy_api_reference |
94 | 108 | end |
95 | 109 |
|
96 | 110 | lane :deployBeta do |options| |
|
0 commit comments