1+ name : Build and Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ jobs :
9+ build-and-release :
10+ runs-on : windows-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+
16+ - name : Install uv
17+ uses : astral-sh/setup-uv@v3
18+ with :
19+ version : " latest"
20+
21+ - name : Set up Python
22+ uses : actions/setup-python@v5
23+ with :
24+ python-version : ' 3.13'
25+
26+ - name : Get version from tag
27+ id : version
28+ run : |
29+ $tag = "${{ github.ref_name }}"
30+ $version = $tag -replace '^v', ''
31+ echo "version=$version" >> $env:GITHUB_OUTPUT
32+ echo "Tag version: $version"
33+
34+ - name : Set filename variables
35+ id : filenames
36+ run : |
37+ $baseName = "Paste Bar Code"
38+ $version = "${{ steps.version.outputs.version }}"
39+ $extension = "exe"
40+ $fullFileName = "$baseName v$version.$extension"
41+ echo "filename=$fullFileName" >> $env:GITHUB_OUTPUT
42+ echo "Filename set to: $fullFileName"
43+
44+ - name : Install dependencies
45+ run : |
46+ uv sync
47+
48+ - name : Build executable with PyInstaller
49+ run : |
50+ uv run pyinstaller --clean main.spec
51+
52+ - name : Rename executable with version
53+ run : |
54+ cd dist
55+ Rename-Item "Paste Bar Code.exe" "${{ steps.filenames.outputs.filename }}"
56+
57+ - name : Generate checksum
58+ run : |
59+ cd dist
60+ Get-FileHash -Path "${{ steps.filenames.outputs.filename }}" -Algorithm SHA256 | Out-File -FilePath "checksum.sha256" -Encoding utf8
61+
62+ - name : Create Release
63+ uses : softprops/action-gh-release@v2
64+ with :
65+ files : |
66+ dist/${{ steps.filenames.outputs.filename }}
67+ dist/checksum.sha256
68+ name : Release v${{ steps.version.outputs.version }}
69+ body : |
70+ ## Release v${{ steps.version.outputs.version }}
71+
72+ ### Download
73+ - `${{ steps.filenames.outputs.filename }}` - Main executable
74+ - `checksum.sha256` - SHA256 checksum for verification
75+
76+ ### Installation
77+ 1. Download the executable
78+ 2. Run it directly
79+
80+ ### Verification
81+ ```powershell
82+ Get-FileHash -Path "${{ steps.filenames.outputs.filename }}" -Algorithm SHA256
83+ ```
84+ Compare the output with the checksum.sha256 file.
85+
86+ ---
87+ *This release was automatically created when version tag was pushed.*
88+ draft : false
89+ prerelease : false
90+ env :
91+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments