From 0be270ab5ad3e3fda1c1dff6657575e9585c1899 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 30 Dec 2022 10:59:44 +0800 Subject: [PATCH] feat: uses toml --- .github/workflows/get_info.py | 7 ++++--- .github/workflows/nuitka.yml | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/get_info.py b/.github/workflows/get_info.py index 22fa41f..5011b3e 100644 --- a/.github/workflows/get_info.py +++ b/.github/workflows/get_info.py @@ -13,8 +13,9 @@ print(os.listdir('.')) sys.path.append(os.path.abspath(os.curdir)) 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}') -os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT') + print(f'DR_version={DR_runtime.DR_version}') + os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT') diff --git a/.github/workflows/nuitka.yml b/.github/workflows/nuitka.yml index 4204f3f..326ea6b 100644 --- a/.github/workflows/nuitka.yml +++ b/.github/workflows/nuitka.yml @@ -31,15 +31,15 @@ jobs: # 获取短 sha - name: Get short commit sha id: get_short_sha - shell: bash + shell: pwsh run: | - short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) - echo "short_sha=$short_sha" >> $GITHUB_OUTPUT - echo $GITHUB_OUTPUT - # $short_sha = Write-Output $`{GITHUB_SHA`} - # $short_sha = $short_sha.substring(1,7) - # Write-Output $short_sha - # Write-Output "short_sha=$short_sha" >> $GITHUB_OUTPUT +# short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) +# echo "short_sha=$short_sha" >> $GITHUB_OUTPUT +# echo $GITHUB_OUTPUT + $short_sha = Write-Output $`{GITHUB_SHA`} + $short_sha = $short_sha.substring(1,7) + Write-Output $short_sha + Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV # 安装 Python @@ -65,6 +65,14 @@ jobs: shell: bash 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 if: runner.os == 'Windows' @@ -110,6 +118,6 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v3 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: | build/*.zip \ No newline at end of file