diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b7ed45f..cbc6755 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -138,6 +138,7 @@ jobs: STORE_ID: ${{ env.store_id }} DEV_ID: ${{ env.dev_id }} BETA_APP: ${{ env.beta_app }} + DEV_EMAIL: ${{ secrets.DEV_EMAIL }} PYTHONUNBUFFERED: 1 if: github.event_name == 'release' run: | diff --git a/cicd/upload_to_garmin.py b/cicd/upload_to_garmin.py index 1f42ab8..2578549 100644 --- a/cicd/upload_to_garmin.py +++ b/cicd/upload_to_garmin.py @@ -14,7 +14,14 @@ DEV_ID = os.getenv("DEV_ID") TAG_NAME = os.getenv("TAG_NAME") BETA_APP = os.getenv("BETA_APP") +DEV_EMAIL = os.getenv("DEV_EMAIL") +try: + release_notes = requests.get( + f"https://api.github.com/repos/{'samueldumont' if BETA_APP == 'true' else 'tommyvdz'}/RunPowerWorkout/releases/tags/{TAG_NAME}" + ).json()["body"] +except: + release_notes = "" print(f"Uploading {STORE_ID} with tag {TAG_NAME}. Beta : {BETA_APP}.") @@ -156,11 +163,411 @@ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36", } -# response = s.post(url, headers=headers, data=m, allow_redirects=True) +response = s.post(url, headers=headers, data=m, allow_redirects=True) print(f"Upload result : {response.status_code}") # UPDATE DETAILS, STILL TODO url = f"https://apps.garmin.com/en-US/developer/{DEV_ID}/apps/{STORE_ID}/edit" response = s.get(url) -soup = BeautifulSoup(response.text, "html.parser") \ No newline at end of file +soup = BeautifulSoup(response.text, "html.parser") + +appDescription = soup.find("textarea", {"id": "app-desc-en"}).renderContents() + +m = MultipartEncoder( + fields=[ + ("localizedAppModel[0].appLocale", "en"), + ( + "localizedAppModel[0].appTitle", + "RunPowerWorkout - beta" if BETA_APP == "true" else "RunPowerWorkout", + ), + ("localizedAppModel[0].appDescription", appDescription), + ("localizedAppModel[0].appWhatsNew", release_notes), + ( + "localizedAppModel[0].heroImageObject", + ( + "", + "", + "application/octet-stream", + ), + ), + ("localizedAppModel[0].deleteHeroImage", "false"), + ("localizedAppModel[0].heroImageUrl", ""), + ("category", "251"), + ("policy", "no"), + ("policyUrl", ""), + ("antPlusProfiles", "no"), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("_antPlusProfilesModel.selectedAntPlusProfiles", (None, "on")), + ("antPlusProfilesModel.enteredAntPlusProfileComments[9999999]", ""), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("_countriesModel.selectedCountries", "on"), + ("regionalLimits", "no"), + ( + "iconFile", + ( + "", + "", + "application/octet-stream", + ), + ), + ( + "screenshotFiles[0]", + ( + "", + "", + "application/octet-stream", + ), + ), + ("screenshotIds[0]", ""), + ("deleted[0]", "false"), + ( + "screenshotFiles[1]", + ( + "", + "", + "application/octet-stream", + ), + ), + ("screenshotIds[1]", ""), + ("deleted[1]", "false"), + ( + "screenshotFiles[2]", + ( + "", + "", + "application/octet-stream", + ), + ), + ("screenshotIds[2]", ""), + ("deleted[2]", "false"), + ( + "screenshotFiles[3]", + ( + "", + "", + "application/octet-stream", + ), + ), + ("screenshotIds[3]", ""), + ("deleted[3]", "false"), + ( + "screenshotFiles[4]", + ( + "", + "", + "application/octet-stream", + ), + ), + ("screenshotIds[4]", ""), + ("deleted[4]", "false"), + ("videoUrl", ""), + ("devEmail", DEV_EMAIL), + ("sourceUrl", "https://github.com/tommyvdz/RunPowerWorkout"), + ("reviewNotificationActive", "true"), + ("migrationAllowed", "true"), + ("paymentModelCheck", "no"), + ("iosAppUrl", ""), + ("androidAppUrl", ""), + ("hardwareProductUrl", ""), + ("betaApp", BETA_APP), + ("submit", ""), + ], + boundary="----WebKitFormBoundary" + + "".join(random.sample(string.ascii_letters + string.digits, 16)), +) + +headers = { + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "Cache-Control": "no-cache", + "Content-Type": m.content_type, + "Origin": "https://apps.garmin.com", + "Referer": url, + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Site": "same-origin", + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36", +} + +response = s.post(url, headers=headers, data=m, allow_redirects=True) +print(f"What's new update result : {response.status_code}") \ No newline at end of file