generate wix file #9
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: Test streamlit executable for Windows with embeddable python | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build-win-executable-with-embeddable-python: | |
runs-on: windows-latest | |
env: | |
PYTHON_VERSION: 3.11.9 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download python embeddable version | |
run: | | |
mkdir python-${{ env.PYTHON_VERSION }} | |
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip | |
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }} | |
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip | |
- name: Install pip | |
run: | | |
curl -O https://bootstrap.pypa.io/get-pip.py | |
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location | |
rm get-pip.py | |
- name: Uncomment 'import site' in python311._pth file | |
run: | | |
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth | |
- name: Print content of python311._pth file | |
run: | | |
cat python-${{ env.PYTHON_VERSION }}/python311._pth | |
- name: Install Required Packages | |
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install -r requirements.txt --no-warn-script-location | |
- name: Create run_app.bat file | |
run: | | |
echo '@echo off' > run_app.bat | |
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run app.py local' >> run_app.bat | |
- name: Create All-in-one executable folder | |
run: | | |
mkdir streamlit_exe | |
mv python-${{ env.PYTHON_VERSION }} streamlit_exe | |
mv run_app.bat streamlit_exe | |
cp -r src streamlit_exe | |
cp -r content streamlit_exe | |
cp -r assets streamlit_exe | |
cp -r example-data streamlit_exe | |
cp -r .streamlit streamlit_exe | |
cp app.py streamlit_exe | |
- name: Install WiX Toolset | |
run: | | |
curl -LO https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip | |
unzip wix311-binaries.zip -d wix | |
rm wix311-binaries.zip | |
- name: Generate WiX XML file | |
run: | | |
echo '<?xml version="1.0"?>' > streamlit_exe.wxs | |
echo '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">' >> streamlit_exe.wxs | |
echo ' <Product Id="*" Name="StreamlitApp" Language="1033" Version="1.0.0.0" Manufacturer="OpenMS" UpgradeCode="8d28e8c7-45dc-446c-b889-99a6aea2f1a5">' >> streamlit_exe.wxs | |
echo ' <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />' >> streamlit_exe.wxs | |
echo ' <Media Id="1" Cabinet="streamlit.cab" EmbedCab="yes" />' >> streamlit_exe.wxs | |
echo ' <Directory Id="TARGETDIR" Name="SourceDir">' >> streamlit_exe.wxs | |
echo ' <Directory Id="ProgramFilesFolder">' >> streamlit_exe.wxs | |
echo ' <Directory Id="INSTALLFOLDER" Name="StreamlitApp">' >> streamlit_exe.wxs | |
echo ' <Component Id="StreamlitFiles" Guid="d6d72df0-9692-4881-b02c-d709580774ef">' >> streamlit_exe.wxs | |
echo ' <File Id="ExeFiles" Source="streamlit_exe/run_app.bat" KeyPath="yes" />' >> streamlit_exe.wxs | |
echo ' <File Id="AppFile" Source="streamlit_exe/app.py" />' >> streamlit_exe.wxs | |
echo ' </Component>' >> streamlit_exe.wxs | |
echo ' </Directory>' >> streamlit_exe.wxs | |
echo ' </Directory>' >> streamlit_exe.wxs | |
echo ' </Directory>' >> streamlit_exe.wxs | |
echo ' <Feature Id="DefaultFeature" Level="1">' >> streamlit_exe.wxs | |
echo ' <ComponentRef Id="StreamlitFiles" />' >> streamlit_exe.wxs | |
echo ' </Feature>' >> streamlit_exe.wxs | |
echo ' </Product>' >> streamlit_exe.wxs | |
echo '</Wix>' >> streamlit_exe.wxs | |
- name: Archive streamlit_exe folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: streamlit_exe | |
path: streamlit_exe |