Merge pull request #5 from axelwalter/mass-calculator #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build executable for Windows | |
on: [push] | |
jobs: | |
build-executable: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Setup virtual environment | |
shell: cmd | |
run: | | |
python -m venv myenv | |
call myenv\Scripts\activate.bat | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Write function to cli.py | |
shell: bash | |
run: | | |
head -n -2 D:/a/umetaflow-gui/umetaflow-gui/myenv/Lib/site-packages/streamlit/web/cli.py > temp_cli.py | |
cat << EOF >> temp_cli.py | |
def _main_run_clExplicit(file, command_line, args=[], flag_options=[]): | |
main._is_running_with_streamlit = True | |
bootstrap.run(file, command_line, args, flag_options) | |
if __name__ == "__main__": | |
main() | |
EOF | |
mv temp_cli.py D:/a/umetaflow-gui/umetaflow-gui/myenv/Lib/site-packages/streamlit/web/cli.py | |
- name: Compile app with pyinstaller | |
shell: cmd | |
run: | | |
call myenv\Scripts\activate.bat | |
pyinstaller --onefile --additional-hooks-dir ./hooks run_app.py --clean | |
- name: Copy everything to dist directory | |
run: | | |
cp -r .streamlit dist/.streamlit | |
cp -r pages dist/pages | |
cp -r src dist/src | |
cp -r assets dist/assets | |
cp -r example-data dist/example-data | |
cp Home.py dist/ | |
- name: Modify .spec file | |
shell: bash | |
run: | | |
cp run_app_temp.spec run_app.spec | |
- name: Make executable | |
shell: cmd | |
run: | | |
call myenv\Scripts\activate.bat | |
pyinstaller run_app.spec --clean | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: UmetaFlow-App | |
path: dist |