Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate github releases. #813

Merged
merged 3 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ reference:
name: Decode Android key store
command: echo $ANDROID_KEYSTORE | base64 -di > keystore.jks

export_github_release_token: &export_github_release_token
run:
name: Export Github release key
command: echo 'export GITHUB_RELEASE_TOKEN="$GITHUB_RELEASE_TOKEN"' >> $BASH_ENV

export_gcloud_key: &export_gcloud_key
run:
name: Export Google Cloud Service key environment variable
Expand Down Expand Up @@ -232,6 +237,7 @@ jobs:
- *attach_release_workspace
- *export_play_key
- *decode_play_key
- *export_github_release_token
- run:
name: Deploy to Play store
command: bundle exec fastlane deploy
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ captures/

# Generated files for deployment
app/versionCode.txt
app/versionName.txt
fastlane/README.md
fastlane/report.xml
fastlane/metadata/android/*/changelogs

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
Expand Down
26 changes: 13 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ GEM
digest-crc (0.4.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.6.0)
dotenv (2.7.2)
emoji_regex (1.0.1)
excon (0.62.0)
excon (0.64.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
Expand All @@ -27,7 +27,7 @@ GEM
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.5)
fastlane (2.116.1)
fastlane (2.122.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
Expand Down Expand Up @@ -56,12 +56,12 @@ GEM
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 1.6.2, < 2.0.0)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.6.0, < 2.0.0)
xcodeproj (>= 1.8.1, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
Expand Down Expand Up @@ -93,19 +93,19 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.1.0)
json (2.2.0)
jwt (2.1.0)
memoist (0.16.0)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mime-types-data (3.2019.0331)
mini_magick (4.5.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.6)
naturally (2.2.0)
os (1.0.0)
os (1.0.1)
plist (3.5.0)
public_suffix (2.0.5)
representable (3.0.4)
Expand All @@ -125,20 +125,20 @@ GEM
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (1.8.0)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-cursor (0.6.0)
tty-cursor (0.6.1)
tty-screen (0.6.5)
tty-spinner (0.9.0)
tty-cursor (~> 0.6.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.1)
unf_ext (0.0.7.6)
unicode-display_width (1.5.0)
word_wrap (1.0.0)
xcodeproj (1.8.1)
xcodeproj (1.9.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
6 changes: 5 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 61
versionName "2.5.7"
versionName "2.5.8"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -111,6 +111,10 @@ task reportVersionCode {
new File("$projectDir/versionCode.txt").text = "$project.android.defaultConfig.versionCode"
}

task reportVersionName {
new File("$projectDir/versionName.txt").text = "$project.android.defaultConfig.versionName"
}

task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
Expand Down
37 changes: 30 additions & 7 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,54 @@
# https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
update_fastlane

default_platform(:android)

platform :android do

desc "Update changelogs based on latest version code"
lane :update_changelogs do
gradle(task: "reportVersionCode")
versionCode = File.read("../app/versionCode.txt")
version_code = File.read("../app/versionCode.txt")

changelog = changelog_from_git_commits(merge_commit_filtering: "exclude_merges", pretty: "- %s")

changelogsDir = "metadata/android/en-US/changelogs"
changelogFile = changelogsDir + "/" + versionCode + ".txt"
changelogs_dir = "metadata/android/en-US/changelogs"
changelog_file = changelogs_dir + "/" + version_code + ".txt"

sh("mkdir", "-p", changelogsDir)
File.open(changelogFile, 'w') do |file|
sh("mkdir", "-p", changelogs_dir)
File.open(changelog_file, 'w') do |file|
file.write changelog
end
end

desc "Release to Github"
lane :github_release do
gradle(task: "reportVersionCode")
version_code = File.read("../app/versionCode.txt")
changelogs_dir = "metadata/android/en-US/changelogs"
changelog_file = changelogs_dir + "/" + version_code + ".txt"

gradle(task: "reportVersionName")
version_name = File.read("../app/versionName.txt")
release_name = "v" + version_name

set_github_release(
repository_name: "CypherpunkArmory/UserLAnd",
api_token: ENV["GITHUB_RELEASE_TOKEN"],
name: release_name,
tag_name: release_name,
description: (File.read(changelog_file) rescue "No changelog provided"),
commitish: "releases",
upload_assets: ["app/build/outputs/apk/release/app-release.apk"]
)
end

desc "Deploy a new version to the Google Play"
lane :deploy do
update_changelogs
github_release
supply(apk: "app/build/outputs/apk/release/app-release.apk")
end
end