Fix the problem of version displayed in about section #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release BulkFolder | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| sonar-scan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check Secret Presence | |
| shell: bash | |
| run: | | |
| if [ -z "${{ secrets.BULK_FOLDER_SCAN }}" ]; then | |
| echo "ERROR: BULK_FOLDER_SCAN secret is missing." | |
| exit 1 | |
| fi | |
| - name: SonarCloud Scan | |
| uses: SonarSource/sonarcloud-github-action@v3.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.BULK_FOLDER_SCAN }} | |
| with: | |
| # Disabling coverage requirement during scan to pass the Quality Gate | |
| args: > | |
| -Dsonar.python.coverage.reportPaths= | |
| -Dsonar.cpd.exclusions=src/bulkfolder/ui/views/** | |
| build: | |
| needs: sonar-scan | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller customtkinter matplotlib | |
| - name: Get version from XML | |
| id: get_version | |
| shell: powershell | |
| run: | | |
| [xml]$project = Get-Content "project_info.xml" | |
| $version = $project.project.version | |
| echo "VERSION=$version" >> $env:GITHUB_OUTPUT | |
| - name: Build EXE with PyInstaller | |
| run: | | |
| echo "import sys, os; sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')); from bulkfolder.ui.main import main; main()" > run.py | |
| # Added project_info.xml to --add-data to fix the version display bug in the compiled app | |
| python -m PyInstaller --noconfirm --windowed --name "BulkFolder" --icon="src/assets/logo.ico" --add-data="src/assets;assets" --add-data="project_info.xml;." --paths="src" --version-file="version_info.txt" --collect-all customtkinter run.py | |
| - name: Compile Inno Setup | |
| shell: pwsh | |
| run: | | |
| $ver = "${{ steps.get_version.outputs.VERSION }}" | |
| & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DMyAppVersion=$ver "installer_script.iss" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.VERSION }} | |
| name: Release v${{ steps.get_version.outputs.VERSION }} | |
| files: Output/*.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |