Update main.yml #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Setup Python 🏭 | |
uses: actions/setup-python@v4 | |
with: | |
check-latest: true | |
python-version: '3.x' | |
- name: Install Ubuntu Dependencies 🧑🏭 | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: e2fsprogs attr unzip qemu-utils python3-venv | |
version: 1.0 | |
- name: Install Python dependencies | |
run: | |
pip install requests | |
- name: Download | |
id: download | |
shell: python | |
run: | | |
import time | |
import urllib | |
import urllib3 | |
import requests | |
from pathlib import Path | |
from typing import Any, OrderedDict | |
from xml.dom import minidom | |
from requests import Session | |
class Prop(OrderedDict): | |
def __init__(self, props: str = ...) -> None: | |
super().__init__() | |
for i, line in enumerate(props.splitlines(False)): | |
if '=' in line: | |
k, v = line.split('=', 1) | |
self[k] = v | |
else: | |
self[f".{i}"] = line | |
def __setattr__(self, __name: str, __value: Any) -> None: | |
self[__name] = __value | |
def __repr__(self): | |
return '\n'.join(f'{item}={self[item]}' for item in self) | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
dir = Path.cwd().parent | |
user_token = "" | |
ReleaseType = "retail" | |
UpdateID = "00000000-0000-0000-0000-000000000000" | |
Version = "0.0.0.0" | |
ReleaseType_list = ["retail", "RP", "WIS", "WIF"] | |
RevisionNumber = 1 | |
session = Session() | |
session.verify = False | |
print(dir) | |
try: | |
response = urllib.request.urlopen("https://raw.githubusercontent.com/bubbles-wow/MS-Account-Token/main/token.cfg") | |
text = response.read().decode("utf-8") | |
user_token = Prop(text).get("user_code") | |
updatetime = Prop(text).get("update_time") | |
print("Successfully get user token from server!") | |
print(f"Last update time: {updatetime}\n") | |
except: | |
print("Notice: You haven't logged in yet. Some UpdateID may not be available.") | |
time.sleep(1) | |
try: | |
response = urllib.request.urlopen("https://raw.githubusercontent.com/bubbles-wow/WSA-Archive/main/UpdateID.cfg") | |
text = response.read().decode("utf-8") | |
Version = Prop(text).get("Version") | |
UpdateID = Prop(text).get("UpdateID") | |
print(f"Version: {Version}\n") | |
except: | |
print("Cannot get UpdateID from server! Please check your network and try again.") | |
exit() | |
Filename = "MicrosoftCorporationII.WindowsSubsystemForAndroid_" + Version + "_neutral_~_8wekyb3d8bbwe.Msixbundle" | |
print(Filename) | |
try: | |
response = urllib.request.urlopen("https://raw.githubusercontent.com/bubbles-wow/WSA-Archive/main/FE3FileUrl.xml") | |
FE3_file_content = response.read().decode("utf-8") | |
except: | |
print("Cannot get UpdateID from server! Please check your network and try again.") | |
exit() | |
try: | |
out = session.post( | |
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', | |
data=FE3_file_content.format(user_token, UpdateID, RevisionNumber, ReleaseType), | |
headers={'Content-Type': 'application/soap+xml; charset=utf-8'} | |
) | |
except: | |
print(f"\rNetwork Error! Please check your network and try again.",end="") | |
time.sleep(1) | |
exit() | |
doc = minidom.parseString(out.text) | |
if len(out.text) < 1500: | |
print("Not found!") | |
exit() | |
url = "" | |
for l in doc.getElementsByTagName("FileLocation"): | |
url = l.getElementsByTagName("Url")[0].firstChild.nodeValue | |
if url.split("/")[2] == "tlu.dl.delivery.mp.microsoft.com": | |
print(url) | |
break | |
file = requests.get(url, stream=True) | |
open(${{ github.workspace }} + "/" + Filename, "wb").write(file.content) | |
if Path.exists(${{ github.workspace }} + "/" + Filename): | |
print("Done!") | |
- name: upload result | |
id: result | |
uses: actions/upload-artifact@v1 | |
with: | |
name: my-artifact | |
path: ${{ github.workspace }}/ |