forked from kliment/Printrun
-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (67 loc) · 2.31 KB
/
buildpackage-mac.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
name: Build macOS app
on:
push:
pull_request:
release:
types:
- created
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12]
architecture: [x64]
python-version: ['3.10']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
architecture: ${{ matrix.architecture }}
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip pyinstaller setuptools wheel cython cffi -r requirements.txt
- name: Build Cython ext
run: |
python setup.py build_ext --inplace
- name: Make pyinstaller spec
run: |
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data images/\*:images --add-data \*.png:. --add-data \*.ico:. -w -i P-face.icns pronterface.py
# Edit spec file
export git_hash=$(git rev-parse --short "$GITHUB_SHA")
sed -i '' '$ s/.$//' pronterface.spec
cat >> pronterface.spec <<EOL
info_plist={
'CFBundleShortVersionString': '$git_hash',
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
'NSAppSleepDisabled': True,
},
)
EOL
- name: Make pyinstaller build
run: |
pyinstaller --clean pronterface.spec -y
# Zip app manually to avoid losing execute permissions for binary file in app
cd dist
zip -r -X pronterface-app.zip pronterface.app
- name: Configuration for releases
if: ${{ github.event_name == 'release' }}
run: |
echo "EXE_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Configuration for pushes
if: ${{ github.event_name == 'push' }}
run: |
echo "EXE_NAME=printrun-nightly" >> $GITHUB_ENV
- name: Configuration for pull requests
if: ${{ github.event_name != 'release' && github.event_name != 'push' }}
run: |
echo "EXE_NAME=printrun-test" >> $GITHUB_ENV
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v3
with:
name: ${{ env.EXE_NAME }}_${{ matrix.os }}_${{ matrix.architecture }}_py${{ matrix.python-version }}
path: dist/pronterface-app.zip