-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.97 KB
/
win-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Windows Build and Release
on:
workflow_run:
workflows: ["Tests"]
types:
- completed
branches: [main]
jobs:
build-windows:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Build with PyInstaller
run: |
pyinstaller --clean --onefile `
--name "pdf-converter" `
--windowed `
src/pdf_converter/app.py
# - name: Create ZIP archive
# run: |
# Compress-Archive -Path "dist/pdf-converter.exe" -DestinationPath "dist/pdf-converter-windows.zip"
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: pdf-converter-windows
# path: dist/pdf-converter-windows.zip
- name: Create ZIP archive
shell: pwsh
run: |
cd dist
if (Test-Path "pdf-converter.exe") {
Compress-Archive -Path "pdf-converter.exe" -DestinationPath "pdf-converter-windows.zip"
echo "dist_empty=false" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
echo "No executable found in dist/"
echo "dist_empty=true" | Out-File -FilePath $env:GITHUB_ENV -Append
}
- name: Generate version
id: version
shell: bash
run: echo "version=$(date +'%Y.%m.%d-%H%M')" >> $GITHUB_OUTPUT
- name: Upload Release
if: env.dist_empty == 'false'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/pdf-converter-windows.zip
tag: v${{ steps.version.outputs.version }}
overwrite: true