-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (127 loc) · 5.4 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# 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 }}/