-
Notifications
You must be signed in to change notification settings - Fork 6
227 lines (182 loc) · 6.7 KB
/
Copy pathpython-app.yml
File metadata and controls
227 lines (182 loc) · 6.7 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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Build Application
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "21 1 * * 1"
workflow_dispatch: # allow manual trigger
push:
tags:
- "*.*.*"
jobs:
build-application:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
NAME: MacOS
- os: windows-latest
NAME: Windows
- os: ubuntu-22.04
NAME: Ubuntu
permissions:
contents: read
steps:
- name: macOS Notarize -- Install Certificates
if: ${{ matrix.NAME == 'MacOS' }}
run: |
echo ${{ secrets.CERTIFICATE_P12 }} | base64 --decode > certificate.p12
security import certificate.p12 -P ${{ secrets.CERTIFICATE_PASSWORD }}
security create-keychain -p fgKeychain fg.keychain
security default-keychain -s fg.keychain
security set-keychain-settings -l -u -t 8000
security unlock-keychain -p fgKeychain fg.keychain
security import certificate.p12 -k fg.keychain -P ${{ secrets.CERTIFICATE_PASSWORD }} -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k fgKeychain fg.keychain
rm -fr *.p12
# security find-identity -v -p codesigning
- name: Git checkout
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: "npm"
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Patch requirements.txt
if: github.ref_type == 'tag'
run: |
python scripts/patch_requirements.py ${{ github.ref_name }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt | tee pip_log.txt
pip install -r requirements-dev.txt
- name: Make and install universal wheels
if: ${{ matrix.NAME == 'MacOS' }}
run: |
python macos/ensure_universal_wheels.py pip_log.txt
pip install --force build/universal_wheels/*.whl
- name: Build app with PyInstaller
run: |
pyinstaller FontraPak.spec -y
- name: Run tests
run: |
pytest
- name: macOS Notarize -- Codesign and Notarize
if: ${{ matrix.NAME == 'MacOS' }}
run: |
APP_PATH="dist/Fontra Pak.app"
DMG_PATH="dist/FontraPak-${{ matrix.NAME }}.dmg"
macos/codesign_app.sh "${{ secrets.CODESIGN_NAME }}" "$APP_PATH" macos/entitlements.plist
python macos/build_dmg.py "$APP_PATH" "$DMG_PATH"
codesign --sign "${{ secrets.CODESIGN_NAME }}" "$DMG_PATH"
echo "Run notarytool..."
xcrun notarytool submit \
--apple-id "${{ secrets.NOTARIZE_DEVELOPER }}" \
--team-id "${{ secrets.NOTARIZE_TEAM_ID }}" \
--password "${{ secrets.NOTARIZE_PASSWORD }}" \
--output-format json \
--wait \
$DMG_PATH \
| python macos/print_notarize_log.py \
"${{ secrets.NOTARIZE_DEVELOPER }}" \
"${{ secrets.NOTARIZE_TEAM_ID }}" \
"${{ secrets.NOTARIZE_PASSWORD }}"
xcrun stapler staple "$DMG_PATH"
- name: Archive executable with tar
if: ${{ matrix.NAME != 'MacOS' && matrix.NAME != 'Windows' }}
run: |
cd ./dist
tar -czvf FontraPak-${{ matrix.NAME }}.tgz fontrapak
- name: Storing Artifacts
uses: actions/upload-artifact@v7
with:
name: FontraPak-${{ matrix.NAME }}
path: |
./dist/*.dmg
./dist/*.exe
./dist/*.tgz
windows-installer:
needs: build-application
runs-on: windows-latest
steps:
- name: Git checkout
uses: actions/checkout@v6
- name: Extract version from tag
if: github.ref_type == 'tag'
run: echo "VERSION=${{ github.ref_name }}" >> $env:GITHUB_ENV
- name: Set dev version
if: github.ref_type != 'tag'
run: echo "VERSION=0.0.0" >> $env:GITHUB_ENV
- name: Download Windows exe
uses: actions/download-artifact@v8
with:
name: FontraPak-Windows
path: dist
- name: Install WiX v6
run: dotnet tool install --global wix --version 6.0.2
- name: Add WiX UI extension
run: wix extension add --global WixToolset.UI.wixext/6.0.2
- name: Compile MSI
run: |
Set-Location windows
wix build Product.wxs -arch x64 -d "Version=${{ env.VERSION }}" -ext WixToolset.UI.wixext -o "$env:GITHUB_WORKSPACE\dist\FontraPak-Windows-Installer.msi"
- name: Storing Windows MSI artifact
uses: actions/upload-artifact@v7
with:
name: FontraPak-Windows-Installer
path: dist/*.msi
create-github-release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [build-application, windows-installer]
if: github.ref_type == 'tag'
steps:
- name: Git checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Retrieve Artifact
uses: actions/download-artifact@v8
with:
path: ./downloaded-artifact
- name: Zip Windows .exe
run: |
cd ./downloaded-artifact/FontraPak-Windows
zip -r FontraPak-Windows.zip "Fontra Pak.exe"
- name: Display structure of downloaded files
run: ls -R
working-directory: ./downloaded-artifact
- name: Extract Latest Changes
run: |
python scripts/extract_latest_changes.py > tmp_latest_changes.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
draft: false
body_path: 'tmp_latest_changes.txt'
token: ${{ secrets.GITHUB_TOKEN }}
files: |
./downloaded-artifact/FontraPak-MacOS/*.dmg
./downloaded-artifact/FontraPak-Windows-Installer/*.msi
./downloaded-artifact/FontraPak-Windows/*.zip
./downloaded-artifact/FontraPak-Ubuntu/*.tgz
- name: Update website / Repository Dispatch
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.WEBSITE_PAT }}
repository: fontra/fontra-website
event-type: release-event
- name: Update flatpak / Repository Dispatch
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.FLATPAK_PAT }}
repository: fontra/fontra-flatpak
event-type: release-event