diff --git a/.github/workflows/build_exe.yml b/.github/workflows/build_exe.yml index 93ffa35..8f69165 100644 --- a/.github/workflows/build_exe.yml +++ b/.github/workflows/build_exe.yml @@ -4,6 +4,9 @@ on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+-?*" + pull_request: + branches: + - main workflow_dispatch: jobs: @@ -70,6 +73,16 @@ jobs: - name: Install PyInstaller run: pip install pyinstaller + - name: Print version string (for tag) + id: get_version_tag + if: ${{ github.ref_type == 'tag' }} + run: echo ${{ github.ref_name }} > VERSION + + - name: Print version string (for branch) + id: get_version_branch + if: ${{ github.ref_type != 'tag' }} + run: echo ${{ github.ref_name }}-${{ github.sha }} > VERSION + - name: Build the executable run: | pyinstaller pyinstaller.spec diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..3510a93 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v0.5.0-alpha.0 diff --git a/components/splash.py b/components/splash.py index 9204a17..8e9cfe8 100644 --- a/components/splash.py +++ b/components/splash.py @@ -1,12 +1,27 @@ from terminal_tools import clear_terminal, wait_for_key +from pathlib import Path +import os def splash(): clear_terminal() print(_ascii_splash) + print("") + print(f"{get_version()}") + print("") wait_for_key(True) +def get_version(): + root_path = str(Path(__file__).resolve().parent.parent) + version_path = os.path.join(root_path, "VERSION") + try: + with open(version_path, "r") as version_file: + return version_file.read().strip() + except FileNotFoundError: + return "" + + _ascii_splash: str = """ -..*+:..- -.=-+%@%##+-=.- diff --git a/pyinstaller.spec b/pyinstaller.spec index 29770fd..dcebb56 100644 --- a/pyinstaller.spec +++ b/pyinstaller.spec @@ -10,6 +10,12 @@ a = Analysis( pathex=['.'], # Ensure all paths are correctly included binaries=[], datas=[ + # version file, if defined + *( + [('VERSION', 'VERSION')] + if os.path.exists('VERSION') else [] + ), + # inquirer depends on readchar as a hidden dependency that requires package metadata *copy_metadata('readchar'),