auto load version

This commit is contained in:
恍兮惚兮 2024-04-27 19:56:54 +08:00
parent b555b32393
commit 221dda18d9
3 changed files with 12 additions and 10 deletions

View File

@ -10,7 +10,6 @@ jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:
# 矩阵配置
matrix: matrix:
include: include:
- architecture: x86 - architecture: x86

View File

@ -1,18 +1,12 @@
name: Release name: Release
on: on:
workflow_dispatch: # allows manual triggering workflow_dispatch:
inputs:
create_release:
description: 'Create new release'
required: true
type: string
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:
# 矩阵配置
matrix: matrix:
include: include:
- architecture: x86 - architecture: x86
@ -46,10 +40,13 @@ jobs:
name: ${{ matrix.fname }} name: ${{ matrix.fname }}
path: build/${{ matrix.fname }}.zip path: build/${{ matrix.fname }}.zip
- name: loaddversion
id: loaddversion
run: python build.py loaddversion
- name: Release LunaTranslator - name: Release LunaTranslator
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.event.inputs.create_release }} tag_name: ${{ steps.loaddversion.outputs.version }}
files: build/${{ matrix.fname }}.zip files: build/${{ matrix.fname }}.zip
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,5 +1,5 @@
import os, sys import os, sys
import shutil import shutil, json
import subprocess import subprocess
import requests import requests
@ -209,6 +209,12 @@ def buildPlugins():
if __name__ == "__main__": if __name__ == "__main__":
if sys.argv[1]=='loaddversion':
os.chdir(rootDir)
with open('LunaTranslator/files/defaultconfig/static_data.json','r',encoding='utf8') as ff:
version=json.loads(ff.read())['version']
print('::set-output name=version::'+version)
exit()
arch = sys.argv[1] arch = sys.argv[1]
isdebug=len(sys.argv)>2 and int(sys.argv[2]) isdebug=len(sys.argv)>2 and int(sys.argv[2])
os.chdir(rootDir) os.chdir(rootDir)