Skip to content

Commit 0a8612d

Browse files
committed
feature: 取消每日触发,改为在AirMCU更新的时候触发同步更新
1 parent 69c38e4 commit 0a8612d

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: release
33
on:
44
push:
55

6-
schedule:
7-
- cron: '0 0 * * *'
6+
repository_dispatch:
7+
types: [ AirMCU ]
88

99
workflow_dispatch:
1010

main.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,40 @@
77
packagesPath = "package_air_index.json"
88

99
GCCVersion = "12.2.1-1.2"
10-
AirISPVersion = "1.1.1.0"
10+
AirISPVersion = "" #不定义具体的版本,在GetAirISPVersion函数中创造
1111
CMSISVersion = "5.7.0"
12-
PlatformsVersion = ["0.0.1"]
12+
PlatformsVersion = []
13+
14+
15+
def GetAirISPVersion():
16+
url = "https://api.github.com/repos/Air-duino/AirISP/releases"
17+
response = requests.get(url)
18+
19+
if response.status_code == 200:
20+
data = response.json()
21+
tags = []
22+
for release in data:
23+
tag = release["tag_name"]
24+
tags.append(tag)
25+
global AirISPVersion
26+
AirISPVersion = str(tags[0])
27+
else:
28+
print(f"Request failed: {response.status_code}")
29+
30+
def GetRepoVersion(owner, repo):
31+
url = f"https://api.github.com/repos/{owner}/{repo}/releases"
32+
33+
response = requests.get(url)
34+
35+
if response.status_code == 200:
36+
data = response.json()
37+
tags = []
38+
for release in data:
39+
tag = release["tag_name"]
40+
tags.append(tag)
41+
return tags
42+
else:
43+
print(f"Request failed: {response.status_code}")
1344

1445

1546
def ComputeSHA256(path):
@@ -183,6 +214,8 @@ def PackagesAirM2M():
183214
data['email'] = "[email protected]"
184215
data['help'] = {'online': "https://github.com/Air-duino"}
185216
platforms = []
217+
218+
PlatformsVersion.extend(GetRepoVersion("Air-duino", "Arduino-AirMCU"))
186219
for item in PlatformsVersion:
187220
platforms.append(PlatformsAirMCU(item))
188221
data['platforms'] = platforms
@@ -201,6 +234,7 @@ def Encode():
201234

202235

203236
def main():
237+
GetAirISPVersion()
204238
print(Encode())
205239

206240

0 commit comments

Comments
 (0)