From e71718dc91a415be24eb8082958424a9e77ffb80 Mon Sep 17 00:00:00 2001 From: Konstantin Aksenov Date: Thu, 11 Apr 2024 09:47:26 +1000 Subject: [PATCH] fix(action): move package and sa to top level --- github-action/entrypoint.sh | 12 +++++++++--- github-action/templates/apk-upload.sh | 14 ++++---------- github-action/templates/bundles-upload.sh | 14 ++++---------- .../templates/deobfuscation-files-upload.sh | 12 +++--------- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/github-action/entrypoint.sh b/github-action/entrypoint.sh index d4e0af9..eeb431d 100644 --- a/github-action/entrypoint.sh +++ b/github-action/entrypoint.sh @@ -31,6 +31,12 @@ USER_FRACTION=${12} echo "Play console version:" google-play-cli version +checkParameter "Service Account JSON" "$SERVICE_ACCOUNT_JSON" +export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="$SERVICE_ACCOUNT_JSON" + +echo "Package name: $PACKAGE_NAME" +export APP_PACKAGE_NAME="$PACKAGE_NAME" + echo "Template: $TEMPLATE" case $TEMPLATE in @@ -45,7 +51,7 @@ 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" "$STATUS" "$USER_FRACTION" + sh /templates/apk-upload.sh "$PATH_TO_APK" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" "$STATUS" "$USER_FRACTION" ;; "bundles-upload") @@ -53,7 +59,7 @@ case $TEMPLATE in 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" "$STATUS" "$USER_FRACTION" + sh /templates/bundles-upload.sh "$PATH_TO_BUNDLE" "$VERSION_CODE" "$TRACK" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" "$STATUS" "$USER_FRACTION" ;; "deobfuscation-files-upload") @@ -61,7 +67,7 @@ case $TEMPLATE in checkParameter "Version code" "$VERSION_CODE" checkParameter "Path to mapping" "$PATH_TO_MAPPING" - sh /templates/deobfuscation-files-upload.sh "$SERVICE_ACCOUNT_JSON" "$PACKAGE_NAME" "$PATH_TO_MAPPING" "$VERSION_CODE" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" + sh /templates/deobfuscation-files-upload.sh "$PATH_TO_MAPPING" "$VERSION_CODE" "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW" ;; *) diff --git a/github-action/templates/apk-upload.sh b/github-action/templates/apk-upload.sh index 5c1ee47..4822a25 100644 --- a/github-action/templates/apk-upload.sh +++ b/github-action/templates/apk-upload.sh @@ -2,8 +2,6 @@ set -e -SERVICE_ACCOUNT_JSON="${1}" -PACKAGE_NAME=$2 PATH_TO_APK=$3 VERSION_CODE=$4 TRACK=$5 @@ -12,7 +10,6 @@ STATUS="${7}" USER_FRACTION=${8} echo "---" -echo "Package name: $PACKAGE_NAME" echo "Path to apk: $PATH_TO_APK" echo "Version code: $VERSION_CODE" echo "Track: $TRACK" @@ -21,19 +18,16 @@ echo "User fraction: $USER_FRACTION" echo "Changes not sent for review: $FLAG_CHANGES_NOT_SENT_FOR_REVIEW" echo "---" -export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="$SERVICE_ACCOUNT_JSON" -export APP_PACKAGE_NAME="$PACKAGE_NAME" - EDIT_ID=$(google-play-cli edit create) echo "Edit id created: $EDIT_ID" echo "Upload APK..." -google-play-cli apk upload --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --apk "$PATH_TO_APK" +google-play-cli apk upload --edit-id "$EDIT_ID" --apk "$PATH_TO_APK" echo "Update track..." -google-play-cli tracks update --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --apk-version-code "$VERSION_CODE" --track "$TRACK" \ +google-play-cli tracks update --edit-id "$EDIT_ID" --apk-version-code "$VERSION_CODE" --track "$TRACK" \ ${USER_FRACTION:+ --user-fraction "$USER_FRACTION"} \ ${STATUS:+ --status "$STATUS"} echo "Validate..." -google-play-cli edit validate --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" || true # Ignore until changes-not-sent-for-review will be added as parameter +google-play-cli edit validate --edit-id "$EDIT_ID" || true # Ignore until changes-not-sent-for-review will be added as parameter echo "Commit..." -google-play-cli edit commit --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" \ +google-play-cli edit commit --edit-id "$EDIT_ID" \ ${FLAG_CHANGES_NOT_SENT_FOR_REVIEW:+ --changes-not-sent-for-review "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW"} diff --git a/github-action/templates/bundles-upload.sh b/github-action/templates/bundles-upload.sh index 758b05e..534248a 100644 --- a/github-action/templates/bundles-upload.sh +++ b/github-action/templates/bundles-upload.sh @@ -2,8 +2,6 @@ set -e -SERVICE_ACCOUNT_JSON="${1}" -PACKAGE_NAME="${2}" PATH_TO_BUNDLE="${3}" VERSION_CODE="${4}" TRACK="${5}" @@ -11,11 +9,7 @@ FLAG_CHANGES_NOT_SENT_FOR_REVIEW="${6}" STATUS="${7}" USER_FRACTION=${8} -export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="$SERVICE_ACCOUNT_JSON" -export APP_PACKAGE_NAME="$PACKAGE_NAME" - echo "---" -echo "Package name: $PACKAGE_NAME" echo "Path to bundle: $PATH_TO_BUNDLE" echo "Version code: $VERSION_CODE" echo "Track: $TRACK" @@ -27,13 +21,13 @@ echo "---" EDIT_ID=$(google-play-cli edit create) 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" +google-play-cli bundles upload --edit-id "$EDIT_ID" --bundle "$PATH_TO_BUNDLE" echo "Update track..." -google-play-cli tracks update --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --apk-version-code "$VERSION_CODE" --track "$TRACK" \ +google-play-cli tracks update --edit-id "$EDIT_ID" --apk-version-code "$VERSION_CODE" --track "$TRACK" \ ${USER_FRACTION:+ --user-fraction "$USER_FRACTION"} \ ${STATUS:+ --status "$STATUS"} echo "Validate..." -google-play-cli edit validate --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" || true # Ignore until changes-not-sent-for-review will be added as parameter +google-play-cli edit validate --edit-id "$EDIT_ID" || true # Ignore until changes-not-sent-for-review will be added as parameter echo "Commit..." -google-play-cli edit commit --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" \ +google-play-cli edit commit --edit-id "$EDIT_ID" \ ${FLAG_CHANGES_NOT_SENT_FOR_REVIEW:+ --changes-not-sent-for-review "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW"} diff --git a/github-action/templates/deobfuscation-files-upload.sh b/github-action/templates/deobfuscation-files-upload.sh index 8e7ba32..5d9e8a1 100644 --- a/github-action/templates/deobfuscation-files-upload.sh +++ b/github-action/templates/deobfuscation-files-upload.sh @@ -2,28 +2,22 @@ set -e -SERVICE_ACCOUNT_JSON="${1}" -PACKAGE_NAME="${2}" PATH_TO_MAPPING="${3}" VERSION_CODE="${4}" FLAG_CHANGES_NOT_SENT_FOR_REVIEW="${5}" echo "---" -echo "Package name: $PACKAGE_NAME" echo "Path to mapping: $PATH_TO_MAPPING" echo "Version code: $VERSION_CODE" echo "Changes not sent for review: $FLAG_CHANGES_NOT_SENT_FOR_REVIEW" echo "---" -export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="$SERVICE_ACCOUNT_JSON" -export APP_PACKAGE_NAME="$PACKAGE_NAME" - EDIT_ID=$(google-play-cli edit create) echo "Edit id created: $EDIT_ID" echo "Upload deobfuscation files..." -google-play-cli deobfuscation-files upload --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" --deobfuscation "$PATH_TO_MAPPING" --apk-version-code "$VERSION_CODE" +google-play-cli deobfuscation-files upload --edit-id "$EDIT_ID" --deobfuscation "$PATH_TO_MAPPING" --apk-version-code "$VERSION_CODE" echo "Validate..." -google-play-cli edit validate --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" || true # Ignore until changes-not-sent-for-review will be added as parameter +google-play-cli edit validate --edit-id "$EDIT_ID" || true # Ignore until changes-not-sent-for-review will be added as parameter echo "Commit..." -google-play-cli edit commit --edit-id "$EDIT_ID" --package-name "$PACKAGE_NAME" \ +google-play-cli edit commit --edit-id "$EDIT_ID" \ ${FLAG_CHANGES_NOT_SENT_FOR_REVIEW:+ --changes-not-sent-for-review "$FLAG_CHANGES_NOT_SENT_FOR_REVIEW"}