Skip to content

Commit

Permalink
Add in-progress workflow and supporting utility for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Hawkins <sjjhsjjhsjjh@gmail.com>
  • Loading branch information
sjjhsjjh committed Apr 15, 2024
1 parent e8705f7 commit 1b46a73
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/windows-build-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
on:
workflow_dispatch:
push:
paths:
- 'assets/Version.ini'

permissions:
contents: write

jobs:

check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Analysing the code with ruff
run: |
ruff check .
# The build job runs on a Windows machine and performs various build steps.
build:
runs-on: windows-latest
needs: check
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Freeze Installer
run: |
pyinstaller build.spec
- name: Build Installer
run: |
iscc installer.iss
- name: Freeze Portable
run: |
pyinstaller --distpath dist-portable build-portable.spec
- name: Get version number
run: |
python src/utils/printversion.py
id: version_number

# - name: Zip Portable
# shell: pwsh
# run: |
# Copy-Item -Path assets -Destination dist-portable\ -Recurse
# Copy-Item -Path configs -Destination dist-portable\ -Recurse
# Compress-Archive -Path dist-portable -DestinationPath FaceCommander-Portable-${{github.ref_name}}.zip

# - name: release
# uses: softprops/action-gh-release@v1
# with:
# files: |
# Output/FaceCommander-Installer-${{github.ref_name}}.exe
# FaceCommander-Portable-${{github.ref_name}}.zip
# tag_name: ${{github.ref_name}}
# draft: false
# prerelease: false
17 changes: 17 additions & 0 deletions src/utils/printversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Standard library imports in alphabetical order.
#
# INI file parser, used to get the version number.
# https://docs.python.org/3/library/configparser.html
from configparser import ConfigParser
#
# Object oriented path handling.
# https://docs.python.org/3/library/pathlib.html
from pathlib import Path

def ini_version():
versionINIPath = Path(__file__).parents[2] / "assets" / "Version.ini"
versionINI = ConfigParser()
versionINI.read(versionINIPath)
return versionINI['Release']['VersionNumber']

if __name__ == "__main__": print(ini_version())

0 comments on commit 1b46a73

Please sign in to comment.