-
Notifications
You must be signed in to change notification settings - Fork 4
154 lines (128 loc) · 4.07 KB
/
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
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
name: Build executables and publish 🐍 package 📦 to PyPI
on:
workflow_dispatch:
release:
types:
- "published"
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- "windows-latest"
#- "macos-latest"
#- "ubuntu-latest"
python:
- "3.10.x"
cx-freeze:
- "v7.2.2"
name: "Build exe for ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
steps:
# === SETUP ===
- name: "Setup python"
uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python }}"
- name: "Install cx_Freeze bootloader"
run: |
python -m pip install cx_Freeze==${{ matrix.cx-freeze }}
# === BUILD ===
- name: "Clone repo"
uses: "actions/checkout@v4"
with:
path: "./src/"
- name: "Install requirements"
run: |
cd ./src/
python -m pip install -U -r ./requirements.txt
- name: "Build"
if: runner.os != 'macOS'
run: |
cd ./src/
python ./buildGUI.py build
mv ./build/*/ ./dist/
- name: "Build macOS"
if: runner.os == 'macOS'
run: |
cd ./src/
python ./buildGUI.py bdist_mac
mkdir ./dist/
mv ./build/*.app/ ./dist/
- name: "Resolve symlinks"
if: runner.os != 'Windows'
run: |
cd ./src/dist/
find ./ -type l -exec echo Resolving {} \; -exec sed -i '' {} \;
# export Apple development certificate from Xcode: https://help.apple.com/xcode/mac/current/#/dev154b28f09
# base64 CERTIFICATE.p12 | pbcopy -> secrets.CODESIGN_P12_BASE64
- name: "Import macOS codesign certificate"
if: runner.os == 'macOS'
uses: "apple-actions/import-codesign-certs@v3"
with:
p12-file-base64: "${{ secrets.CODESIGN_P12_BASE64 }}"
p12-password: "${{ secrets.CODESIGN_P12_PASSWORD }}"
# security find-identity, returns something like:
# A30C8432FADE0B3E7D5BA54034EF2ECA39A0BDD0 "Apple Development: dcnieho@gmail.com (6LR9J7UR6F)"
# the first hex string is your identity -> secrets.CODESIGN_P12_NAME
- name: "Codesign macOS"
if: runner.os == 'macOS'
run: |
cd ./src/dist/
find ./ -type f -empty -delete
codesign -s "${{ secrets.CODESIGN_P12_NAME }}" --deep -f ./*.app
# === ARTIFACT ===
- name: "Zip artifact"
run: |
7z a -r ./${{ github.event.repository.name }}-${{ runner.os }}.zip ./src/dist/*
- name: "Upload artifact to workflow run"
uses: actions/upload-artifact@v4
with:
name: executable
path: "./${{ github.event.repository.name }}-${{ runner.os }}.zip"
- name: "Upload artifact to release"
uses: "softprops/action-gh-release@v2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
files: "./${{ github.event.repository.name }}-${{ runner.os }}.zip"
wheel:
name: Package 📦 wheel and upload to PyPI
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.10.x"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: "Upload wheel as workflow artifact"
uses: actions/upload-artifact@v4
with:
name: wheel
path: ./dist/*.whl
- name: Upload wheel as release artifact
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
files: "./dist/*.whl"
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@v1.10.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}