-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (116 loc) · 3.49 KB
/
Copy pathrelease.yml
File metadata and controls
132 lines (116 loc) · 3.49 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: Release tag, for example v1.0.0
required: true
type: string
prerelease:
description: Mark this release as a prerelease
required: false
default: false
type: boolean
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: windows
os: windows-latest
artifact-name: write4print-windows
executable: write4print.exe
pyinstaller-extra: --windowed
- platform: linux
os: ubuntu-latest
artifact-name: write4print-linux
executable: write4print
pyinstaller-extra: ""
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y python3-tk libgl1 libglib2.0-0
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt pyinstaller
- name: Build executable
shell: bash
run: |
pyinstaller \
--name write4print \
--onefile \
${{ matrix.pyinstaller-extra }} \
main.py
- name: Add Linux desktop launcher
if: runner.os == 'Linux'
shell: bash
run: |
mkdir -p release
cp "dist/${{ matrix.executable }}" release/
chmod +x "release/${{ matrix.executable }}"
cat > release/write4print.desktop <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=write4print
Comment=PDF handwriting print converter
Exec=write4print
Terminal=false
Categories=Office;Graphics;
DESKTOP
- name: Collect Windows executable
if: runner.os == 'Windows'
shell: bash
run: |
mkdir -p release
cp "dist/${{ matrix.executable }}" release/
- name: Package Linux artifact
if: runner.os == 'Linux'
shell: bash
run: |
tar -C release -czf "${{ matrix.artifact-name }}.tar.gz" .
- name: Package Windows artifact
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path release\* -DestinationPath "${{ matrix.artifact-name }}.zip"
- name: Upload packaged artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: |
${{ matrix.artifact-name }}.zip
${{ matrix.artifact-name }}.tar.gz
if-no-files-found: ignore
publish:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
name: write4print ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
files: release-assets/*