Refactor release workflow to use softprops/action-gh-release for asse… #4
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 | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| 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 -e ".[dev]" | |
| - name: Build with PyInstaller | |
| run: | | |
| pyinstaller --onefile --windowed --name "PDF-Page-Selector" --add-data "style.qss;." main.py | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install vpk | |
| run: dotnet tool install -g vpk | |
| - name: Generate version number | |
| id: version | |
| run: | | |
| $version = "1.0.${{ github.run_number }}" | |
| echo "VERSION=$version" >> $env:GITHUB_OUTPUT | |
| echo "Version: $version" | |
| - name: Package with Velopack | |
| run: | | |
| vpk pack --packId kelltom.pdfpageselector --packVersion ${{ steps.version.outputs.VERSION }} --packDir .\dist --mainExe PDF-Page-Selector.exe | |
| - name: Find nupkg file | |
| run: | | |
| $nupkg = Get-ChildItem -Path .\Releases\*.nupkg | Select-Object -First 1 | |
| if ($nupkg) { | |
| echo "NUPKG_PATH=$($nupkg.FullName)" >> $env:GITHUB_OUTPUT | |
| echo "NUPKG_NAME=$($nupkg.Name)" >> $env:GITHUB_OUTPUT | |
| } | |
| id: find_nupkg | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.VERSION }} | |
| name: Release v${{ steps.version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ./Releases/kelltom.pdfpageselector-${{ steps.version.outputs.VERSION }}-win-Setup.exe | |
| ./Releases/RELEASES | |
| ${{ steps.find_nupkg.outputs.NUPKG_PATH }} |