Skip to content

Commit

Permalink
fix(action): move package and sa to top level
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Apr 10, 2024
1 parent 71be8d6 commit e71718d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
12 changes: 9 additions & 3 deletions github-action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,23 +51,23 @@ 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")
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" "$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")
checkParameter "Package name" "$PACKAGE_NAME"
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"
;;

*)
Expand Down
14 changes: 4 additions & 10 deletions github-action/templates/apk-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

set -e

SERVICE_ACCOUNT_JSON="${1}"
PACKAGE_NAME=$2
PATH_TO_APK=$3
VERSION_CODE=$4
TRACK=$5
Expand All @@ -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"
Expand All @@ -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"}
14 changes: 4 additions & 10 deletions github-action/templates/bundles-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

set -e

SERVICE_ACCOUNT_JSON="${1}"
PACKAGE_NAME="${2}"
PATH_TO_BUNDLE="${3}"
VERSION_CODE="${4}"
TRACK="${5}"
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"
Expand All @@ -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"}
12 changes: 3 additions & 9 deletions github-action/templates/deobfuscation-files-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

0 comments on commit e71718d

Please sign in to comment.