mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-06 05:49:03 +08:00
Add custom upload for ipa
This commit is contained in:
9
.github/workflows/ios.yml
vendored
9
.github/workflows/ios.yml
vendored
@@ -59,3 +59,12 @@ jobs:
|
||||
with:
|
||||
name: app
|
||||
path: build/ios/iphoneos/app.ipa
|
||||
- name: Upload to site
|
||||
env:
|
||||
BASE_URL: ${{ secrets.IPA_BASE_URL }}
|
||||
USERNAME: ${{ secrets.IPA_USERNAME }}
|
||||
PASSWORD: ${{ secrets.IPA_PASSWORD }}
|
||||
continue-on-error: true
|
||||
run: |
|
||||
python3 -m pip install requests
|
||||
python3 scripts/upload_ipa.py "${BASE_URL}" build/ios/iphoneos/app.ipa "${USERNAME}" "${PASSWORD}"
|
||||
|
||||
23
scripts/upload_ipa.py
Normal file
23
scripts/upload_ipa.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import argparse
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import os
|
||||
|
||||
def upload_ipa(baseurl: str, file_path: str, username: str, password: str):
|
||||
url = f"{baseurl}/api/upload"
|
||||
basic = HTTPBasicAuth(username, password)
|
||||
re = requests.post(url, files={"file": open(file_path, "rb")}, auth=basic, timeout=60)
|
||||
json = re.json()
|
||||
if "err" in json and json["err"]:
|
||||
raise Exception(f"Error uploading file: {json['err']}")
|
||||
print("Uploaded file successfully")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Upload an IPA file to the server")
|
||||
parser.add_argument("baseurl", help="The base URL of the server")
|
||||
parser.add_argument("file", help="The IPA file to upload")
|
||||
parser.add_argument("username", help="The username to authenticate with")
|
||||
parser.add_argument("password", help="The password to authenticate with")
|
||||
args = parser.parse_args()
|
||||
upload_ipa(args.baseurl, args.file, args.username, args.password)
|
||||
Reference in New Issue
Block a user