Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a232fc71a |
@@ -77,27 +77,3 @@ jobs:
|
|||||||
uses: akkuman/gitea-release-action@v1
|
uses: akkuman/gitea-release-action@v1
|
||||||
with:
|
with:
|
||||||
files: ${{ env.AAB_PATH }}
|
files: ${{ env.AAB_PATH }}
|
||||||
|
|
||||||
- name: Decode Play Console service account key
|
|
||||||
# Skipped (rather than failing the whole run) until the secret is
|
|
||||||
# set up - see tool/upload_play_bundle.py's doc comment for what
|
|
||||||
# that setup involves and its one hard prerequisite: Google won't
|
|
||||||
# accept API calls for an app that's never had a single manual
|
|
||||||
# upload through the Play Console web UI.
|
|
||||||
if: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64 != '' }}
|
|
||||||
run: echo "$SERVICE_ACCOUNT_JSON_BASE64" | base64 -d > "${{ runner.temp }}/play-service-account.json"
|
|
||||||
env:
|
|
||||||
SERVICE_ACCOUNT_JSON_BASE64: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64 }}
|
|
||||||
|
|
||||||
- name: Upload App Bundle to Play Console library
|
|
||||||
# Deliberately doesn't touch any release track - see
|
|
||||||
# tool/upload_play_bundle.py. Uploaded bundles show up under
|
|
||||||
# Release > App bundle explorer in Play Console, ready to promote
|
|
||||||
# to a track by hand whenever it's actually time to ship.
|
|
||||||
if: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64 != '' }}
|
|
||||||
run: |
|
|
||||||
pip install --quiet google-api-python-client google-auth
|
|
||||||
python3 tool/upload_play_bundle.py "${{ env.AAB_PATH }}"
|
|
||||||
env:
|
|
||||||
GOOGLE_PLAY_PACKAGE_NAME: dev.ayushya.noo
|
|
||||||
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH: ${{ runner.temp }}/play-service-account.json
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Uploads an .aab to the Play Console's app bundle library, without
|
|
||||||
touching any release track.
|
|
||||||
|
|
||||||
Play Console itself doesn't expose "just upload, don't release" as an
|
|
||||||
action - every path through the UI attaches a bundle to a track. The Play
|
|
||||||
Developer API does support it though: open an edit, upload the bundle,
|
|
||||||
commit the edit, and stop there. The result shows up under Release > App
|
|
||||||
bundle explorer and nowhere else - nothing goes out to testers or
|
|
||||||
production until it's promoted to a track by hand, whenever that's wanted.
|
|
||||||
|
|
||||||
Needs:
|
|
||||||
GOOGLE_PLAY_PACKAGE_NAME e.g. dev.ayushya.noo
|
|
||||||
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH path to a service account key file
|
|
||||||
|
|
||||||
The Play Developer API can't create an app's first release - Google
|
|
||||||
requires at least one manual upload through the Play Console web UI (to
|
|
||||||
any track) before it'll accept API calls for that app at all.
|
|
||||||
|
|
||||||
python3 tool/upload_play_bundle.py path/to/app-release.aab
|
|
||||||
"""
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from google.oauth2 import service_account
|
|
||||||
from googleapiclient.discovery import build
|
|
||||||
|
|
||||||
SCOPES = ["https://www.googleapis.com/auth/androidpublisher"]
|
|
||||||
|
|
||||||
|
|
||||||
def main(bundle_path):
|
|
||||||
package_name = os.environ["GOOGLE_PLAY_PACKAGE_NAME"]
|
|
||||||
key_path = os.environ["GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH"]
|
|
||||||
creds = service_account.Credentials.from_service_account_file(
|
|
||||||
key_path, scopes=SCOPES
|
|
||||||
)
|
|
||||||
service = build("androidpublisher", "v3", credentials=creds)
|
|
||||||
|
|
||||||
edit_id = service.edits().insert(body={}, packageName=package_name).execute()["id"]
|
|
||||||
|
|
||||||
bundle = (
|
|
||||||
service.edits()
|
|
||||||
.bundles()
|
|
||||||
.upload(editId=edit_id, packageName=package_name, media_body=bundle_path)
|
|
||||||
.execute()
|
|
||||||
)
|
|
||||||
print("Uploaded versionCode %s" % bundle["versionCode"])
|
|
||||||
|
|
||||||
service.edits().commit(editId=edit_id, packageName=package_name).execute()
|
|
||||||
print(
|
|
||||||
"Committed - visible under Release > App bundle explorer in Play "
|
|
||||||
"Console. Not attached to any track, so nothing goes out to "
|
|
||||||
"testers or production until it's promoted by hand."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main(sys.argv[1])
|
|
||||||
Reference in New Issue
Block a user