66 - main
77
88jobs :
9- check_last_commit_author :
9+ release-and-publish :
1010 runs-on : ubuntu-latest
11- outputs :
12- skip_ci : ${{ steps.check_last_commit_author.outputs.skip_ci }}
13- steps :
14- - name : Checkout repository
15- uses : actions/checkout@v4
16- with :
17- fetch-depth : 0
18- - name : Check last commit author
19- id : check_last_commit_author
20- run : |
21- LAST_COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an')
22- if [ "$LAST_COMMIT_AUTHOR" = "OpenAdapt Bot" ]; then
23- echo "skip_ci=true" >> $GITHUB_OUTPUT
24- fi
25-
26- build-macos-executables :
27- name : Build macOS app
28- runs-on : macos-latest
29- needs : check_last_commit_author
30- if : ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }}
31- steps :
32- - name : Checkout repository
33- uses : actions/checkout@v4
34- with :
35- fetch-depth : 0
36- - name : Set up Python
37- uses : actions/setup-python@v5
38- with :
39- python-version : ' 3.10'
40- - name : Install dependencies
41- run : |
42- pip install poetry
43- poetry install
44- brew install nvm
45- poetry run postinstall
46- brew install python-tk@3.10
47- - name : Build MacOS executable
48- run : |
49- poetry run python -m openadapt.build
50- cd dist
51- zip -r ../OpenAdapt.app.zip OpenAdapt.app
52- mv OpenAdapt.dmg ..
53- cd ..
54- - name : Upload MacOS executable
55- uses : actions/upload-artifact@v4
56- with :
57- name : OpenAdapt.app
58- path : OpenAdapt.app.zip
59- - name : Upload MacOS installer
60- uses : actions/upload-artifact@v4
61- with :
62- name : OpenAdapt.dmg
63- path : OpenAdapt.dmg
64-
65- build-windows-executables :
66- name : Build Windows app
67- runs-on : windows-latest
68- needs : check_last_commit_author
69- if : ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }}
70- steps :
71- - name : Checkout repository
72- uses : actions/checkout@v4
73- with :
74- fetch-depth : 0
75- - name : Set up Python
76- uses : actions/setup-python@v5
77- with :
78- python-version : ' 3.10'
79- - name : Set up Node.js
80- uses : actions/setup-node@v4
81- with :
82- node-version : 21
83- - name : Install dependencies
84- run : |
85- pip install poetry
86- poetry install
87- cd openadapt/app/dashboard
88- npm install
89- cd ../../../
90- pip install wheel
91- poetry run postinstall
92- - name : Build Windows executable
93- run : |
94- poetry run python -m openadapt.build
95- cd dist
96- 7z a -tzip ../OpenAdapt.zip OpenAdapt
97- move OpenAdapt_Installer.exe ..
98- cd ..
99- - name : Upload Windows executable
100- uses : actions/upload-artifact@v4
101- with :
102- name : OpenAdapt
103- path : OpenAdapt.zip
104- - name : Upload Windows installer
105- uses : actions/upload-artifact@v4
106- with :
107- name : OpenAdapt_Installer
108- path : OpenAdapt_Installer.exe
109-
110- test_on_macos :
111- name : Test on macOS
112- runs-on : macos-latest
113- needs : [build-macos-executables]
114- outputs :
115- macos_build_status : ${{ steps.test_on_macos.outputs.status }}
116- steps :
117- - name : Checkout repository
118- uses : actions/checkout@v4
119- with :
120- fetch-depth : 0
121- - name : Download macOS executable
122- uses : actions/download-artifact@v4
123- with :
124- name : OpenAdapt.app
125- path : dist/
126- - name : Run app
127- id : test_on_macos
128- run : |
129- ./build_scripts/test_app_run_macos.sh
130- EXIT_CODE=$?
131- if [ $EXIT_CODE -ne 0 ]; then
132- echo "macos_build_status=failed" >> $GITHUB_OUTPUT
133- fi
134-
135- test_on_windows :
136- name : Test on Windows
137- runs-on : windows-latest
138- needs : [build-windows-executables]
139- outputs :
140- windows_build_status : ${{ steps.test_on_windows.outputs.windows_build_status }}
141- steps :
142- - name : Checkout repository
143- uses : actions/checkout@v4
144- with :
145- fetch-depth : 0
146- - name : Download Windows executable
147- uses : actions/download-artifact@v4
148- with :
149- name : OpenAdapt
150- path : dist/
151- - name : Run app
152- id : test_on_windows
153- shell : powershell
154- run : |
155- cmd.exe /c .\build_scripts\test_app_run_windows.bat
156- if ($LastExitCode -ne 0) {
157- "windows_build_status=failed" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
158- }
159-
160- consolidate_tests :
161- name : Consolidate test results
162- runs-on : ubuntu-latest
163- needs : [test_on_windows, test_on_macos]
164- steps :
165- - name : Consolidate test results
166- id : consolidate_test_results
167- run : |
168- if [ "${{ needs.test_on_windows.outputs.windows_build_status }}" = "failed" ] || [ "${{ needs.test_on_macos.outputs.macos_build_status }}" = "failed" ]; then
169- echo "Error: Tests failed"
170- exit 1
171- fi
172-
173- release :
174- runs-on : ubuntu-latest
175- needs : [consolidate_tests]
17611 concurrency : release
17712 permissions :
17813 id-token : write
@@ -182,68 +17,39 @@ jobs:
18217 uses : actions/checkout@v4
18318 with :
18419 fetch-depth : 0
185- token : ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication
20+ token : ${{ secrets.ADMIN_TOKEN }}
21+
22+ - name : Check if should skip
23+ id : check_skip
24+ run : |
25+ if [ "$(git log -1 --pretty=format:'%an')" = "OpenAdapt Bot" ]; then
26+ echo "skip=true" >> $GITHUB_OUTPUT
27+ fi
28+
18629 - name : Set up Python
30+ if : steps.check_skip.outputs.skip != 'true'
18731 uses : actions/setup-python@v5
18832 with :
18933 python-version : ' 3.10'
190- - name : Install the latest version of the project
191- run : |
192- git pull
193- pip install poetry
194- poetry install
195- - name : Download macOS executable
196- uses : actions/download-artifact@v4
197- with :
198- name : OpenAdapt.app
199- path : dist/
200- - name : Download Windows executable
201- uses : actions/download-artifact@v4
202- with :
203- name : OpenAdapt
204- path : dist/
205- - name : Download macOS installer
206- uses : actions/download-artifact@v4
207- with :
208- name : OpenAdapt.dmg
209- path : dist/
210- - name : Download Windows installer
211- uses : actions/download-artifact@v4
212- with :
213- name : OpenAdapt_Installer
214- path : dist/
34+
35+ - name : Install dependencies
36+ if : steps.check_skip.outputs.skip != 'true'
37+ run : pip install poetry
38+
21539 - name : Python Semantic Release
216- id : semantic_release
40+ if : steps.check_skip.outputs.skip != 'true'
21741 uses : python-semantic-release/python-semantic-release@v9.6.0
21842 with :
219- github_token : ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication
43+ github_token : ${{ secrets.ADMIN_TOKEN }}
22044 git_committer_name : " OpenAdapt Bot"
22145 git_committer_email : " bot@openadapt.ai"
222- - name : Upload release assets
223- env :
224- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
225- run : |
226- ./build_scripts/upload_release_artifacts.sh
22746
228- publish :
229- name : Publish to PyPI
230- needs : [release]
231- runs-on : ubuntu-latest
232- steps :
233- - name : Checkout repository
234- uses : actions/checkout@v4
235- with :
236- ref : main
237- - name : Set up Python
238- uses : actions/setup-python@v5
239- with :
240- python-version : ' 3.10'
241- - name : Publish to PyPI
47+ - name : Build and publish to PyPI
48+ if : steps.check_skip.outputs.skip != 'true'
24249 env :
243- PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
50+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
24451 run : |
245- pip install poetry
246- poetry install
52+ git pull
24753 poetry config pypi-token.pypi $PYPI_TOKEN
24854 poetry build
24955 poetry publish --no-interaction --skip-existing
0 commit comments