Update release.yml #25
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: | |
| # JOB 1 : Analyse de code sur Linux (Docker requis) | |
| sonar-scan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| # SHA pour actions/checkout@v4.1.1 | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| fetch-depth: 0 | |
| - name: SonarCloud Scan | |
| # SHA mis à jour pour SonarSource/sonarcloud-github-action@v3.1.0 | |
| uses: SonarSource/sonarcloud-github-action@e283307525381a179374092b3f11467464010a30 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.BULK_FOLDER_SCAN }} | |
| # JOB 2 : Build de l'exécutable sur Windows | |
| build: | |
| needs: sonar-scan # Sécurité : bloque le build si le scan échoue | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| - name: Set up Python | |
| # SHA pour actions/setup-python@v5.0.0 | |
| uses: actions/setup-python@0a5c61591373683505ea898e09a3ee4f39ef2b9c | |
| 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: Create version_info.txt | |
| shell: powershell | |
| run: | | |
| $ver = "${{ steps.get_version.outputs.VERSION }}".Split('.') | |
| $v1,$v2,$v3 = $ver[0],$ver[1],$ver[2] | |
| $template = @" | |
| VSVersionInfo( | |
| ffi=FixedFileInfo(filevers=($v1,$v2,$v3,0), prodvers=($v1,$v2,$v3,0), mask=0x3f, flags=0x0, OS=0x40004, fileType=0x1, subtype=0x0, date=(0, 0)), | |
| kids=[StringFileInfo([StringTable(u'040904B0', [ | |
| StringStruct(u'CompanyName', u'BulkFolder Contributors'), | |
| StringStruct(u'FileDescription', u'Bulk folder organizer and renamer'), | |
| StringStruct(u'FileVersion', u'${{ steps.get_version.outputs.VERSION }}'), | |
| StringStruct(u'InternalName', u'BulkFolder'), | |
| StringStruct(u'LegalCopyright', u'MIT License'), | |
| StringStruct(u'OriginalFilename', u'BulkFolder.exe'), | |
| StringStruct(u'ProductName', u'BulkFolder'), | |
| StringStruct(u'ProductVersion', u'${{ steps.get_version.outputs.VERSION }}')])]), | |
| VarFileInfo([VarStruct(u'Translation', [1033, 1200])])] | |
| ) | |
| "@ | |
| $template | Out-File -FilePath version_info.txt -Encoding utf8 | |
| - 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 | |
| python -m PyInstaller --noconfirm --windowed --name "BulkFolder" --icon="src/assets/logo.ico" --add-data="src/assets;assets" --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 | |
| # SHA pour softprops/action-gh-release@v1 | |
| uses: softprops/action-gh-release@de2c5731105a9687dd2b1f4021029c29c8e5e8a6 | |
| 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 }} |