-
Notifications
You must be signed in to change notification settings - Fork 931
/
Copy pathFastfile
108 lines (80 loc) · 3.48 KB
/
Fastfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
desc "Deploy APK to GitHub"
lane :deploy_github do
props = property_file_read(file: "app/version/version.properties")
version = props["VERSION"]
releaseNotes = File.read("../app/version/release-notes")
apkPath = "app/build/outputs/apk/release/duckduckgo-#{version}-release.apk"
token = ENV["GITHUB_UPLOAD_TOKEN"]
UI.message ("Upload new app version to GitHub\nVersion: #{version}\nRelease Notes:\n=====\n#{releaseNotes}\n=====\n")
set_github_release(
repository_name: "DuckDuckGo/Android",
api_token: token,
name: version,
tag_name: version,
description: releaseNotes,
upload_assets: [apkPath],
is_draft: false,
is_prerelease: false)
end
# Note, this currently relies on having `git flow` tools installed.
# This dependency could be removed with a little more time to tidy up this script to do the branching/merging manually.
desc "Create new release"
lane :release do
UI.header "Creating a new release"
UI.message ("Checking current branch: #{git_branch}")
ensure_git_status_clean
ensure_git_branch(
branch: 'develop'
)
newVersion = prompt(text: "\nLast release was: #{last_git_tag}\nEnter New Version Number:")
releaseNotes = prompt(text: "Release Notes: ", multi_line_end_keyword: "END")
commits = changelog_from_git_commits(
between: [last_git_tag, "HEAD"],
pretty: "- %s",
date_format: "short",
match_lightweight_tag: false,
merge_commit_filtering: "exclude_merges"
)
UI.message ("Performing a new release for #{newVersion}")
if UI.confirm("Are you sure you're happy with this release?\n\nVersion=#{newVersion}\nCommits Since Last Release:\n#{commits}\nRelease Notes:\n#{releaseNotes}\n")
UI.success "Creating release branch for release/#{newVersion}"
sh "git flow release start #{newVersion}"
File.open('../app/version/version.properties', 'w') do |file|
file.write("VERSION=#{newVersion}")
end
File.open('../app/version/release-notes', 'w') do |file|
file.write("""## What's new in this release?
#{releaseNotes}
## Have feedback?
You can always reach us at https://duckduckgo.com/feedback.""")
end
if UI.confirm(text:"If you have any other changes to make to the release branch, do them now. Enter `y` when ready to create and push tags")
git_commit(path: "*", message: "Updated release notes and version number for new release - #{newVersion}")
sh "git flow release finish -mnFS '#{newVersion}' '#{newVersion}'"
push_git_tags
sh "git push origin master"
sh "git push origin develop"
UI.header("#{newVersion} has been successfully released 🎉")
else
UI.error "Release cancelled 😢"
end
else
UI.error "Release cancelled 😢"
end
end
end