feat: uses toml

This commit is contained in:
shenjack 2022-12-30 10:59:44 +08:00
parent ff0dba26a5
commit 0be270ab5a
2 changed files with 21 additions and 12 deletions

View File

@ -13,8 +13,9 @@ print(os.listdir('.'))
sys.path.append(os.path.abspath(os.curdir)) sys.path.append(os.path.abspath(os.curdir))
print(sys.path) print(sys.path)
from Difficult_Rocket import DR_runtime if os.path.abspath(os.curdir) in sys.path:
from Difficult_Rocket import DR_runtime
print(f'DR_version={DR_runtime.DR_version}') print(f'DR_version={DR_runtime.DR_version}')
os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT') os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT')

View File

@ -31,15 +31,15 @@ jobs:
# 获取短 sha # 获取短 sha
- name: Get short commit sha - name: Get short commit sha
id: get_short_sha id: get_short_sha
shell: bash shell: pwsh
run: | run: |
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) # short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
echo "short_sha=$short_sha" >> $GITHUB_OUTPUT # echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
echo $GITHUB_OUTPUT # echo $GITHUB_OUTPUT
# $short_sha = Write-Output $`{GITHUB_SHA`} $short_sha = Write-Output $`{GITHUB_SHA`}
# $short_sha = $short_sha.substring(1,7) $short_sha = $short_sha.substring(1,7)
# Write-Output $short_sha Write-Output $short_sha
# Write-Output "short_sha=$short_sha" >> $GITHUB_OUTPUT Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
# 安装 Python # 安装 Python
@ -65,6 +65,14 @@ jobs:
shell: bash shell: bash
run: python .github/workflows/get_info.py run: python .github/workflows/get_info.py
- name: Get DR toml info
id: toml_info
shell: pwsh
uses: SebRollen/toml-action@v1.0.1
with:
file: 'configs/main.toml'
field: 'runtime.version'
# 还是得我自己写脚本 # 还是得我自己写脚本
- name: Build on Windows - name: Build on Windows
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -110,6 +118,6 @@ jobs:
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Difficult-Rocket_v${{steps.DR_info.outputs.DR_version}}-${{runner.os}}_${{matrix.python-version}}-Build.${{github.run_number}}+${{steps.get_short_sha.outputs.short_sha}} name: Difficult-Rocket_v${{steps.toml_info.outputs.value}}-${{runner.os}}_${{matrix.python-version}}-Build.${{github.run_number}}+${{steps.get_short_sha.outputs.short_sha}}
path: | path: |
build/*.zip build/*.zip