From 8f762f05dbf4c29763d081a570c99991a3ea93d2 Mon Sep 17 00:00:00 2001 From: asforest Date: Sat, 8 Jan 2022 22:24:03 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 8 ++++++++ .github/workflows/test.yml | 7 +++++++ build.spec | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d37acde..4312d95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,12 @@ on: push: tags: - "v*" + workflow_dispatch: + inputs: + version_name: + description: 'a version name' + required: false + default: '0.0.0' jobs: build: @@ -19,6 +25,8 @@ jobs: key: ${{ hashFiles('**/requirements.txt') }} - name: Build + env: + PROJECT_VERSION: ${{ github.event.inputs.version_name }} run: | tzutil /s "China Standard Time" python -m pip install wheel setuptools virtualenv diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 542868b..1a9b8c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,11 @@ on: pull_request: branches: [ main ] workflow_dispatch: + inputs: + version_name: + description: 'a version name' + required: false + default: 'test-version' jobs: build: @@ -19,6 +24,8 @@ jobs: key: ${{ hashFiles('**/requirements.txt') }} - name: Build + env: + PROJECT_VERSION: ${{ github.event.inputs.version_name }} run: | tzutil /s "China Standard Time" python -m pip install wheel setuptools virtualenv diff --git a/build.spec b/build.spec index 667731d..e2a2722 100644 --- a/build.spec +++ b/build.spec @@ -16,11 +16,12 @@ def get_git_sha(): return os.getenv('GITHUB_SHA', '') # 生成版本号文件 +import os import json import time metadata_file = 'meta.json' -version_text = get_git_tag('0.0.0') +version_text = get_git_tag(os.getenv('PROJECT_VERSION', '0.0.0')) commit_sha = get_git_sha() compile_time = time.strftime("%Y-%m-%d %H:%M-%S %z")