Skip to content

Commit

Permalink
Merge pull request #5 from AIO-GAME/1.x
Browse files Browse the repository at this point in the history
1.x
  • Loading branch information
xinansky authored Jun 10, 2024
2 parents ac56bde + dcae9b5 commit c357196
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<p align="center"><a href="README_EN.md">English</a> | 简体中文</p>
<p align="center">
<a href="https://github.com/AIO-GAME/Runner/security/policy">
<img alt="" src="https://img.shields.io/github/package-json/unity/AIO-GAME/Runner">
<img alt="" src="https://img.shields.io/github/package-json/unity/AIO-GAME/Unity.Runner">
</a>
<a href="https://github.com/AIO-Game/Runner">
<img src="https://img.shields.io/github/license/AIO-Game/Runner" alt=""/>
<img src="https://img.shields.io/github/license/AIO-Game/Unity.Runner" alt=""/>
</a>
<a href="https://github.com/AIO-Game/Runner">
<img src="https://img.shields.io/github/languages/code-size/AIO-Game/Runner?label=size" alt=""/>
<img src="https://img.shields.io/github/languages/code-size/AIO-Game/Unity.Runner?label=size" alt=""/>
</a>
<a href="https://openupm.com/packages/com.aio.runner/">
<img src="https://img.shields.io/npm/v/com.aio.runner?label=openupm&amp;registry_uri=https://package.openupm.com" alt=""/>
Expand Down Expand Up @@ -108,7 +108,7 @@ Runner.StartCoroutine(mono, T1(), T2());
Runner.StopCoroutine(Test);
Runner.StopCoroutine(mono);```
Runner.StopCoroutine(mono, Test);
Runner.StopCoroutine(Test());<h4>Task</h4>
Runner.StopCoroutine(Test());
```

<h4>开启协程</h4>
Expand Down
8 changes: 4 additions & 4 deletions .github/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<p align="center"><a href="README_EN.md">简体中文</a> | English</p>
<p align="center">
<a href="https://github.com/AIO-GAME/Runner/security/policy">
<img alt="" src="https://img.shields.io/github/package-json/unity/AIO-GAME/Runner">
<img alt="" src="https://img.shields.io/github/package-json/unity/AIO-GAME/Unity.Runner">
</a>
<a href="https://github.com/AIO-Game/Runner">
<img src="https://img.shields.io/github/license/AIO-Game/Runner" alt=""/>
<img src="https://img.shields.io/github/license/AIO-Game/Unity.Runner" alt=""/>
</a>
<a href="https://github.com/AIO-Game/Runner">
<img src="https://img.shields.io/github/languages/code-size/AIO-Game/Runner?label=size" alt=""/>
<img src="https://img.shields.io/github/languages/code-size/AIO-Game/Unity.Runner?label=size" alt=""/>
</a>
<a href="https://openupm.com/packages/com.aio.runner/">
<img src="https://img.shields.io/npm/v/com.aio.runner?label=openupm&amp;registry_uri=https://package.openupm.com" alt=""/>
Expand Down Expand Up @@ -108,7 +108,7 @@ Runner.StartCoroutine(mono, T1(), T2());
Runner.StopCoroutine(Test);
Runner.StopCoroutine(mono);```
Runner.StopCoroutine(mono, Test);
Runner.StopCoroutine(Test());<h4>Task</h4>
Runner.StopCoroutine(Test());
```

<h4>Start Task</h4>
Expand Down
66 changes: 45 additions & 21 deletions .github/upversion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import shutil
import time
import json
import os
import shutil
import subprocess
from typing import Any
import time

from tqdm import tqdm
import requests
from tqdm import tqdm


def get_latest_github_tag(repo_url) -> str | None:
Expand Down Expand Up @@ -70,7 +69,6 @@ def remove_readonly(func, path, _) -> None:
func(path)


# 删除文件夹
def delete_folder(folder_path) -> None:
try:
if os.path.exists(folder_path):
Expand All @@ -89,21 +87,36 @@ def read_current_branch() -> str: # 判断当前分支
return branch.replace("* ", "")


def read_current_version() -> str:
subprocess.run(['git', 'fetch', '--tags'], check=True)
tags = os.popen("git tag").read().split("\n")
# 所有标签去掉空字符串 -preview标签去掉preview 然后按照version排序 1.2.3-preview -> 1.3.0-preview
tags = sorted([tag.replace("-preview", "") for tag in tags if tag], key=lambda x: list(map(int, x.split("."))))
return tags[-1]
def read_local_username() -> str:
result = subprocess.run(['git', 'config', 'user.name'], stdout=subprocess.PIPE)
return result.stdout.decode('utf-8').strip()


def read_local_email() -> str:
result = subprocess.run(['git', 'config', 'user.email'], stdout=subprocess.PIPE)
return result.stdout.decode('utf-8').strip()


def read_current_version() -> str | None:
try:
subprocess.run(['git', 'fetch', '--tags'], check=True)
tags = os.popen("git tag").read().split("\n")
if len(tags) == 0: # 需要判断是否有标签列表
return None
# 所有标签去掉空字符串 -preview标签去掉preview 然后按照version排序 1.2.3-preview -> 1.3.0-preview
tags = sorted([tag.replace("-preview", "") for tag in tags if tag], key=lambda x: list(map(int, x.split("."))))
return tags[-1]
except Exception:
return None


# 切换上一级目录
os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
current_path = os.getcwd()
print("当前路径: " + current_path)

username = "Star fire"
email = "xinansky99@gmail.com"
username = read_local_username()
email = read_local_email()
print("用户名称: " + username)
print("用户邮箱: " + email)

Expand Down Expand Up @@ -137,21 +150,24 @@ def read_current_version() -> str:
step_function()

version = read_current_version() # 读取当前版本号
print("当前版本号: " + version)
# 递增版本号
version_list = version.split(".")
if is_preview:
version_list[2] = str(int(version_list[2]) + 1) + "-preview"
if version is None:
version = "1.0.0" + ("-preview" if is_preview else "")
new_version = "1.0.0" + ("-preview" if is_preview else "")
else:
version_list[2] = str(int(version_list[2]) + 1)
new_version = ".".join(version_list)
# 递增版本号
version_list = version.split(".")
if is_preview:
version_list[2] = str(int(version_list[2]) + 1) + "-preview"
else:
version_list[2] = str(int(version_list[2]) + 1)
new_version = ".".join(version_list)
print("版本号: {0} -> {1}".format(version, new_version))

# 写入新版本号
with open("package.json", "r+") as f:
package = json.load(f)
current_version = package["version"]
package["version"] = new_version
package["type"] = "module"
f.seek(0)
json.dump(package, f, indent=2)
print("写入配置: 版本号 {0} -> {1}".format(current_version, new_version))
Expand Down Expand Up @@ -222,6 +238,14 @@ def read_current_version() -> str:
else:
print("删除成功")

# 写入新版本号
with open("package.json", "r+") as f:
package = json.load(f)
package["type"] = "module"
f.seek(0)
json.dump(package, f, indent=2)
f.close()

steps = [
("删除标签", lambda: delete_remote_tag()),
("设置用户名",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"coroutine",
"task"
],
"type": "module",
"author": {
"name": "AIO GAME",
"url": "https://github.com/AIO-GAME/Unity.Runner"
},
"type": "library"
"url": "https://github.com/AIO-GAME"
}
}

0 comments on commit c357196

Please sign in to comment.