This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
forked from dotb/readyci
-
Notifications
You must be signed in to change notification settings - Fork 1
Enrich android play store upload #27
Open
timmutton
wants to merge
19
commits into
develop
Choose a base branch
from
tech/enrich_android_play_store_upload
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
44b2018
[FIX] Filter out apk's we know to be bad
b9c6b9e
Search project folders for apk rather than try to infer location
c10ff96
Derive package name from apk file rather than pass as parameter
7ac0e9b
Use version name as release name
a590b82
Filter out known non -release apks
cb5b574
Add more filtering to APKs that we'll accept
2120d0a
Merge branch 'fix/apk_filtering' into tech/enrich_android_play_store_…
daf07a9
Convert AndroidUploadStore to kotlin
551d646
Convert AndroidUploadHockeyapp to kotlin
7fc17c1
Extract common apk lookup logic
3103771
Allow file name filters to be a configurable parameter
ce4a049
Dont enforce debuggable status in hockey app builds
4205911
Added more information to the errors, enough information for the user…
davtao a2918d4
Added same error messaging for store upload
davtao 6d91173
Add maven libs to gitignore
a486684
Update jacoco version
ca64f6d
Merge branch 'tech/enrich_android_play_store_upload' of github.com:De…
dc964a2
Remove lib folder entirely
6e51aaf
Merge in develop
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ public void performTask(BuildEnvironment buildEnvironment) throws TaskFailedExce | |
String scheme = buildEnvironment.getProperty(BUILD_PROP_SCHEME); | ||
String keystorePath = buildEnvironment.getProperty(BUILD_PROP_JAVA_KEYSTORE_PATH); | ||
String storePass = buildEnvironment.getProperty(BUILD_PROP_STOREPASS); | ||
|
||
// TODO: these are likely to be incorrect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to clean this one up before we merge? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be a separate fix, this is just something while i was digging around |
||
String unsignedApkPath = String.format("%s/app/build/outputs/apk/%s/app-%s-unsigned.apk", buildEnvironment.getProjectPath(), scheme.toLowerCase(), scheme.toLowerCase()); | ||
String signedApkPath = String.format("%s/app/build/outputs/apk/%s/app-%s.apk", buildEnvironment.getProjectPath(), scheme.toLowerCase(), scheme.toLowerCase()); | ||
|
||
|
60 changes: 0 additions & 60 deletions
60
src/main/java/com/squarepolka/readyci/tasks/app/android/AndroidUploadHockeyapp.java
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
src/main/java/com/squarepolka/readyci/tasks/app/android/AndroidUploadHockeyapp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.squarepolka.readyci.tasks.app.android | ||
|
||
import com.squarepolka.readyci.configuration.AndroidPropConstants | ||
import com.squarepolka.readyci.configuration.ReadyCIConfiguration | ||
import com.squarepolka.readyci.taskrunner.BuildEnvironment | ||
import com.squarepolka.readyci.tasks.Task | ||
import com.squarepolka.readyci.tasks.app.android.extensions.isDebuggable | ||
import com.squarepolka.readyci.tasks.app.android.extensions.isSigned | ||
import com.squarepolka.readyci.util.Util | ||
import net.dongliu.apk.parser.ApkFile | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.stereotype.Component | ||
|
||
import java.io.File | ||
|
||
@Component | ||
class AndroidUploadHockeyapp : Task() { | ||
|
||
companion object { | ||
private const val TASK_UPLOAD_HOCKEYAPP = "android_upload_hockeyapp" | ||
} | ||
|
||
override fun taskIdentifier(): String = TASK_UPLOAD_HOCKEYAPP | ||
|
||
override fun performTask(buildEnvironment: BuildEnvironment) { | ||
val hockappToken = buildEnvironment.getProperty(AndroidPropConstants.BUILD_PROP_HOCKEYAPP_TOKEN) | ||
val releaseTags = buildEnvironment.getProperty(AndroidPropConstants.BUILD_PROP_HOCKEYAPP_RELEASE_TAGS, "") | ||
val releaseNotes = buildEnvironment.getProperty(AndroidPropConstants.BUILD_PROP_HOCKEYAPP_RELEASE_NOTES, "") | ||
val filenameFilters = buildEnvironment.getProperties(AndroidPropConstants.BUILD_PROP_FILENAME_FILTERS, | ||
listOf("zipaligned", "unsigned")) | ||
|
||
if(hockappToken == null) { | ||
throw RuntimeException("AndroidUploadStore: Missing vital details for play store deployment:\n- hockappToken is required") | ||
} | ||
|
||
val filteredApks = AndroidUtil.findAllApkOutputs(buildEnvironment.projectPath) | ||
.filter { file -> | ||
filenameFilters.none { file.nameWithoutExtension.contains(it) } | ||
} | ||
.map { Pair(it, ApkFile(it)) } | ||
.filter { it.second.isSigned } | ||
|
||
when(filteredApks.size) { | ||
0 -> throw RuntimeException("Could not find the signed APK") | ||
1 -> {} // do nothing | ||
else -> throw RuntimeException("There are too many valid APKs that we can upload, please provide a more specific scheme for this pipeline ") | ||
} | ||
|
||
val rawFile = filteredApks.first().first | ||
|
||
executeCommand(arrayOf("/usr/bin/curl", "https://rink.hockeyapp.net/api/2/apps/upload", | ||
"-H", "X-HockeyAppToken: $hockappToken", | ||
"-F", "ipa=@${rawFile.absolutePath}", | ||
"-F", "notes=$releaseNotes", | ||
"-F", "tags=$releaseTags", | ||
"-F", "notes_type=0", // Textual release notes | ||
"-F", "status=2", // Make this version available for download | ||
"-F", "notify=1", // Notify users who can install the app | ||
"-F", "strategy=add", // Add the build if one with the same build number exists | ||
"-F", "mandatory=1" // Download is mandatory | ||
), buildEnvironment.projectPath) | ||
} | ||
} |
125 changes: 0 additions & 125 deletions
125
src/main/java/com/squarepolka/readyci/tasks/app/android/AndroidUploadStore.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @timmutton , do you mind adding some documentation for the new fileNameFilters parameter on the Github wiki and example config file?