Skip to content

Commit 8242a5d

Browse files
- implement release workflow
- exclude main.spec in .gitignore
1 parent b2b6b95 commit 8242a5d

3 files changed

Lines changed: 130 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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 }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MANIFEST
3030
# Usually these files are written by a python script from a template
3131
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3232
*.manifest
33-
*.spec
33+
# *.spec
3434

3535
# Installer logs
3636
pip-log.txt

main.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['src\\main.py'],
6+
pathex=[],
7+
binaries=[('C:\\_My\\Projects\\Programming\\Python\\_My\\paste-bar-code\\.venv\\Lib\\site-packages\\pyzbar\\libiconv.dll', 'pyzbar'), ('C:\\_My\\Projects\\Programming\\Python\\_My\\paste-bar-code\\.venv\\Lib\\site-packages\\pyzbar\\libzbar-64.dll', 'pyzbar')],
8+
datas=[('.\\src\\resources\\', 'resources')],
9+
hiddenimports=[],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='Paste Bar Code',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=False,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

0 commit comments

Comments
 (0)