Modify build workflow for publishing and artifact handling #14
Workflow file for this run
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 | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore src/WinOptimizer.AI.csproj | |
| - name: Build | |
| run: dotnet build src/WinOptimizer.AI.csproj --configuration Release --no-restore | |
| - name: Publish | |
| # Désactivation du SingleFile pour éviter les crashs WPF et du SelfContained pour la légèreté | |
| run: dotnet publish src/WinOptimizer.AI.csproj -c Release -r win-x64 --self-contained false -p:PublishSingleFile=false -p:PublishReadyToRun=true -o ./publish | |
| - name: Zip Artifact | |
| # On compresse tout le dossier publish pour que l'app ait toutes ses DLL à côté | |
| shell: pwsh | |
| run: Compress-Archive -Path ./publish/* -DestinationPath ./WinOptimizer.AI_v1.0.0.zip | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WinOptimizer.AI-Build | |
| path: ./WinOptimizer.AI_v1.0.0.zip | |
| release: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: WinOptimizer.AI-Build | |
| path: . | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| # On envoie le fichier ZIP au lieu de l'EXE seul | |
| files: ./WinOptimizer.AI_v1.0.0.zip | |
| generate_release_notes: true | |
| make_latest: true |