动态获取CC版本号 (#237)

* 动态获取CC版本号
release CI使用latest
snapshot 使用 pre-release(如果有的话)

* Windows 添加安装 requests 模块步骤
Linux及macOS 修正python版本和路径

* macOS 添加安装 requests 步骤
修正命令参数位置

* getLatest接收Repo,使其不止能用在CC上

* 修正macOS使用的pip版本
This commit is contained in:
scdhh
2021-08-27 00:04:34 +08:00
committed by GitHub
parent 60ef83dd34
commit 159cd74c28
3 changed files with 56 additions and 74 deletions

View File

@@ -38,15 +38,11 @@ jobs:
- name: Unpack love
run: |
7z x .\love-11.3-win64.zip
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/win64.zip
pip install requests
$CCVersion=python .\.github\workflows\getLatest.py -P
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/win64.zip
- name: Unpack ColdClear
run: |
7z x .\win64.zip -oColdClear
@@ -112,15 +108,10 @@ jobs:
run: |
chmod 777 ./love-11.3-x86_64.AppImage
./love-11.3-x86_64.AppImage --appimage-extract
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/linux.zip
CCVersion=$(python3 ./.github/workflows/getLatest.py -P)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/linux.zip
- name: Unpack ColdClear
run: |
7z x ./linux.zip -oColdClear
@@ -187,16 +178,11 @@ jobs:
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "platforms;android-30"
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "ndk;21.3.6528147"
export ANDROID_HOME=$(pwd)
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_armv7.zip
CCVersion=$(python3 ./.github/workflows/getLatest.py -P)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_armv7.zip
- name: Unpack ColdClear
run: |
7z x ./android_aarch64.zip -oColdClear/android_aarch64
@@ -259,15 +245,11 @@ jobs:
- name: Unpack template
run: |
7z x ./Techmino.app.zip
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Get CCloader
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/macOS.zip
pip3 install requests
CCVersion=$(python3 ./.github/workflows/getLatest.py -P)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/macOS.zip
unzip macOS.zip
- name: Modify template
run: |
@@ -296,4 +278,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Techmino_${{ env.Version }}_${{ GITHUB.RUN_NUMBER }}_${{ env.CommitID }}_macOS
path: Techmino.zip
path: Techmino.zip

27
.github/workflows/getLatest.py vendored Normal file
View File

@@ -0,0 +1,27 @@
import requests
import time
import json
import argparse
def getColdClear(args):
while True:
get = requests.get(f'https://api.github.com/repos/{args.Repo}/releases')
if get.status_code != 200:
time.sleep(2)
else:
break
getJson = json.loads(get.text)
if args.Pre:
print (getJson[0]['tag_name'])
else:
for i in getJson:
if i['prerelease'] == args.Pre:
print (i['tag_name'])
break
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='用于获取Github仓库的最新Release版本名')
parser.add_argument('-P', '--Pre', action='store_true', help = '是否获取pre')
parser.add_argument('-R', '--Repo', default = '26F-Studio/cold_clear_ai_love2d_wrapper', help = '获取的仓库, 默认为cold_clear_ai_love2d_wrapper, 输入格式为User/Repo')
args = parser.parse_args()
getColdClear(args)

View File

@@ -34,15 +34,11 @@ jobs:
- name: Unpack love
run: |
7z x .\love-11.3-win64.zip
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/win64.zip
pip install requests
$CCVersion=python .\.github\workflows\getLatest.py
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/win64.zip
- name: Unpack ColdClear
run: |
7z x .\win64.zip -oColdClear
@@ -104,15 +100,11 @@ jobs:
- name: Unpack love
run: |
7z x .\love-11.3-win32.zip
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/win32.zip
pip install requests
$CCVersion=python .\.github\workflows\getLatest.py
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/win32.zip
- name: Unpack ColdClear
run: |
7z x .\win32.zip -oColdClear
@@ -176,15 +168,10 @@ jobs:
run: |
chmod 777 ./love-11.3-x86_64.AppImage
./love-11.3-x86_64.AppImage --appimage-extract
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/linux.zip
CCVersion=$(python3 ./.github/workflows/getLatest.py)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/linux.zip
- name: Unpack ColdClear
run: |
7z x ./linux.zip -oColdClear
@@ -248,16 +235,11 @@ jobs:
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "platforms;android-30"
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "ndk;21.3.6528147"
export ANDROID_HOME=$(pwd)
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_armv7.zip
CCVersion=$(python3 ./.github/workflows/getLatest.py)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_armv7.zip
- name: Unpack ColdClear
run: |
7z x ./android_aarch64.zip -oColdClear/android_aarch64
@@ -326,16 +308,11 @@ jobs:
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "platforms;android-30"
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=. --install "ndk;21.3.6528147"
export ANDROID_HOME=$(pwd)
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Download ColdClear
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/android_armv7.zip
CCVersion=$(python3 ./.github/workflows/getLatest.py)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_aarch64.zip
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/android_armv7.zip
- name: Unpack ColdClear
run: |
7z x ./android_aarch64.zip -oColdClear/android_aarch64
@@ -396,15 +373,11 @@ jobs:
- name: Unpack template
run: |
7z x ./Techmino.app.zip
- id: CClatest
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: 26F-Studio
repo: cold_clear_ai_love2d_wrapper
excludes: prerelease, draft
- name: Get CCloader
run: |
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/${{ steps.CClatest.outputs.release }}/macOS.zip
pip3 install requests
CCVersion=$(python3 ./.github/workflows/getLatest.py)
curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/$CCVersion/macOS.zip
unzip macOS.zip
- name: Modify template
run: |