Skip to content

Commit

Permalink
feat(core): add status for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Apr 9, 2024
1 parent 0b2de6b commit a3e7bbe
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 11 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ inputs:
description: 'Do not send changes for review'
required: false
default: 'false'
status:
description: 'The status of a release'
required: false
default: 'draft'

runs:
using: 'docker'
Expand All @@ -53,3 +57,4 @@ runs:
- ${{ inputs.path-to-bundle }}
- ${{ inputs.path-to-mapping }}
- ${{ inputs.changes-not-sent-for-review }}
- ${{ inputs.status }}
2 changes: 1 addition & 1 deletion github-action/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/vacxe/google-play-cli:0.4.0
FROM ghcr.io/vacxe/google-play-cli:0.4.1

COPY entrypoint.sh /entrypoint.sh
COPY templates /templates
Expand Down
5 changes: 3 additions & 2 deletions github-action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PATH_TO_BUNDLE=${8}
PATH_TO_MAPPING=${9}

FLAG_CHANGES_NOT_SENT_FOR_REVIEW=${10}
STATUS=${11}

echo "Play console version:"
google-play-cli version
Expand All @@ -43,15 +44,15 @@ case $TEMPLATE in
checkParameter "Version code" "$VERSION_CODE"
checkParameter "Path to apk" "$PATH_TO_APK"

sh /templates/apk-upload.sh "$SERVICE_ACCOUNT_JSON" "$PACKAGE_NAME" "$PATH_TO_APK" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW"
sh /templates/apk-upload.sh "$SERVICE_ACCOUNT_JSON" "$PACKAGE_NAME" "$PATH_TO_APK" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" "$STATUS"
;;

"bundles-upload")
checkParameter "Package name" "$PACKAGE_NAME"
checkParameter "Version code" "$VERSION_CODE"
checkParameter "Path to bundle" "$PATH_TO_BUNDLE"

sh /templates/bundles-upload.sh "$SERVICE_ACCOUNT_JSON" "$PACKAGE_NAME" "$PATH_TO_BUNDLE" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW"
sh /templates/bundles-upload.sh "$SERVICE_ACCOUNT_JSON" "$PACKAGE_NAME" "$PATH_TO_BUNDLE" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" "$STATUS"
;;

"deobfuscation-files-upload")
Expand Down
5 changes: 3 additions & 2 deletions github-action/templates/apk-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ PACKAGE_NAME=$2
PATH_TO_APK=$3
VERSION_CODE=$4
TRACK=$5
FLAG_CHANGES_NOT_SENT_FOR_REVIEW=$5
FLAG_CHANGES_NOT_SENT_FOR_REVIEW=$6
STATUS="${7}"

echo "---"
echo "Package name: $PACKAGE_NAME"
Expand All @@ -25,7 +26,7 @@ echo "Edit id created: $EDIT_ID"
echo "Upload APK..."
google-play-cli apk upload --config-content "$SERVICE_ACCOUNT_JSON" --edit-id "$EDIT_ID" --apk "$PATH_TO_APK"
echo "Update track..."
google-play-cli tracks update --edit-id "$EDIT_ID" --track "$TRACK" --apk-version-code "$VERSION_CODE"
google-play-cli tracks update --edit-id "$EDIT_ID" --track "$TRACK" --apk-version-code "$VERSION_CODE" --status "$STATUS"
echo "Validate..."
google-play-cli edit validate --edit-id "$EDIT_ID"
echo "Commit..."
Expand Down
3 changes: 2 additions & 1 deletion github-action/templates/bundles-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PATH_TO_BUNDLE="${3}"
VERSION_CODE="${4}"
TRACK="${5}"
FLAG_CHANGES_NOT_SENT_FOR_REVIEW="${6}"
STATUS="${7}"

export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="$SERVICE_ACCOUNT_JSON"
export APP_PACKAGE_NAME="$PACKAGE_NAME"
Expand All @@ -25,7 +26,7 @@ echo "Edit id created: $EDIT_ID"
echo "Upload Bundle..."
google-play-cli bundles upload --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --bundle "$PATH_TO_BUNDLE"
echo "Update track..."
google-play-cli tracks update --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --track "$TRACK" --apk-version-code "$VERSION_CODE"
google-play-cli tracks update --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --track "$TRACK" --apk-version-code "$VERSION_CODE" --status "$STATUS"
echo "Validate..."
google-play-cli edit validate --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME"
echo "Commit..."
Expand Down
25 changes: 24 additions & 1 deletion src/main/kotlin/com/github/vacxe/googleplaycli/Commands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,24 @@ object Commands {
help = "Fraction of users who are eligible to receive the release. 0 < fraction < 1. To be set, release status must be \"inProgress\" or \"halted\"."
).double().default(1.0)

private val status: String by option(
"--status",
"-s",
help = ""
).choice("statusUnspecified", "draft", "inProgress", "halted", "completed").default("draft")

override fun run(api: PlayStoreApi) =
api.tracksPatch(TracksPatchModel(packageName, editId, track, apkVersionCode, userFraction, parameters))
api.tracksPatch(
TracksPatchModel(
packageName,
editId,
track,
apkVersionCode,
userFraction,
status,
parameters
)
)
}

class Update : EditCommand(
Expand All @@ -635,13 +651,20 @@ object Commands {
help = "Fraction of users who are eligible to receive the release. 0 < fraction < 1. To be set, release status must be \"inProgress\" or \"halted\"."
).double().default(1.0)

private val status: String by option(
"--status",
"-s",
help = ""
).choice("statusUnspecified", "draft", "inProgress", "halted", "completed").default("draft")

override fun run(api: PlayStoreApi) = api.tracksUpdate(
TracksUpdateModel(
packageName,
editId,
track,
apkVersionCode,
userFraction,
status,
parameters
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fun main(args: Array<String>) {
addCmd {
object : CliktCommand(name = "version", help = "Library version code") {
override fun run() {
println("0.4.0")
println("0.4.1")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface Tracks : BaseAction {
listOf(TrackRelease().apply {
versionCodes = mutableListOf(model.apkVersionCode.toLong())
userFraction = model.userFraction
status = model.status
})
)
return edits
Expand All @@ -57,9 +58,11 @@ interface Tracks : BaseAction {
val edits: AndroidPublisher.Edits = androidPublisher.edits()
val editId = model.editId ?: edits.insert(model.packageName, null).execute().id

val release = TrackRelease()
.setVersionCodes(listOf(model.apkVersionCode.toLong()))
.setStatus("completed")
val release = TrackRelease().apply {
versionCodes = mutableListOf(model.apkVersionCode.toLong())
userFraction = model.userFraction
status = model.status
}

val track = Track().setReleases(listOf(release))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ class TracksPatchModel(val packageName: String,
val track: String,
val apkVersionCode: Int,
val userFraction: Double,
val status: String,
requestParameters: String?
): RequestModel(requestParameters)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ class TracksUpdateModel(
val track: String,
val apkVersionCode: Int,
val userFraction: Double,
val status: String,
requestParameters: String?
) : RequestModel(requestParameters)

0 comments on commit a3e7bbe

Please sign in to comment.