-
Notifications
You must be signed in to change notification settings - Fork 20
188 lines (163 loc) · 5.3 KB
/
create_release.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Release
on:
workflow_dispatch:
inputs:
draft:
description: 'Draft'
type: boolean
required: true
pypi:
description: 'Deploy to PyPi'
type: boolean
required: true
win:
description: 'Build for Windows'
type: boolean
required: true
mac:
description: 'build for macOS'
type: boolean
required: true
jobs:
pypi-release:
if: ${{ inputs.pypi }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.8 # old to support Windows 7
- name: Update package index
run: sudo apt-get update
- name: Install wxPython dependencies
# list of packages from https://github.com/wxWidgets/Phoenix/
run: |
sudo apt install \
dpkg-dev \
build-essential \
python3-dev \
freeglut3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libunwind-dev \
libgstreamer-plugins-base1.0-dev \
libgtk-3-dev \
libjpeg-dev \
libnotify-dev \
libpng-dev \
libsdl2-dev \
libsm-dev \
libtiff-dev \
libwebkit2gtk-4.0-dev \
libxtst-dev
- name: Compile translation files and build distribution
run: |
python3 build/update_loc.py --compile
pip3 install build
python3 -m build
- name: Publish to pypi
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_TOKEN }}
win-build:
if: ${{ inputs.win }}
runs-on: windows-2019
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.8" # needs to be 3.8 to support Windows 7
- name: Install dependencies
run: |
pip install .[gui]
python build/update_loc.py --compile
echo "VERSION_STRING=v$(grep 'version' pyproject.toml | awk '{print $3}' | sed 's/\"//g')" >> $GITHUB_ENV
- uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: pdfstitcher/gui/app.py
onefile: true
include-data-dir: |
resources/locale=resources/locale
include-package-data: pdf_mangler
output-file: pdfstitcher.exe
windows-console-mode: disable
windows-icon-from-ico: resources/stitcher-icon.ico
- name: GH Release
uses: softprops/action-gh-release@v2
with:
files: build/pdfstitcher.exe
draft: ${{ inputs.draft }}
tag_name: ${{ env.VERSION_STRING }}
mac-build:
if: ${{ inputs.mac }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ runner.arch }}
cache: 'pip'
- name: Install dependencies and compile translation files
run: |
brew install qpdf
pip install ".[gui]"
python build/update_loc.py --compile
echo "VERSION_STRING=v$(grep 'version' pyproject.toml | awk '{print $3}' | sed 's/\"//g')" >> $GITHUB_ENV
- name: Configure code signing
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_SIGN_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_SIGN_PASSWORD }}
- name: Build with Nuitka
env:
APPLE_SIGN_IDENTITY: ${{ secrets.APPLE_SIGN_IDENTITY }}
run: |
pip install nuitka
chmod +x build/mac_build_and_sign.sh
./build/mac_build_and_sign.sh
- name: Create dmg
run: |
brew install create-dmg
create-dmg \
--volname "PDFStitcher Installer" \
--background "resources/install_background.png" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "pdfstitcher.app" 145 185 \
--no-internet-enable \
--app-drop-link 595 185 \
--codesign "${{ secrets.APPLE_SIGN_IDENTITY }}" \
"PDFStitcher-Installer.dmg" \
"build/pdfstitcher.app"
- name: Rename with arch
run: mv PDFStitcher-Installer.dmg "PDFStitcher-Installer${{ runner.arch }}.dmg"
- name: Notarize
uses: love-actions/xcode-notarizer@v1
with:
product-path: "PDFStitcher-Installer${{ runner.arch }}.dmg"
apple-id: ${{ secrets.APPLE_ID }}
app-password: ${{ secrets.APPLE_APP_PASSWORD }}
team-id: ${{ secrets.APPLE_TEAM_ID }}
staple: true
- name: GH Release
uses: softprops/action-gh-release@v2
with:
files: "PDFStitcher-Installer${{ runner.arch }}.dmg"
draft: ${{ inputs.draft }}
tag_name: ${{ env.VERSION_STRING }}