From 4cb782c0f6a642229880313fec02b500131c0ccd Mon Sep 17 00:00:00 2001 From: Maurane GLAUDE Date: Fri, 23 Aug 2024 10:24:24 +0200 Subject: [PATCH] ci(workflow): fix deploy workflow --- .github/workflows/deploy.yml | 13 ++++--------- scripts/package_antares_installer.sh | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index afff97ee35..3032a540ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -54,17 +54,12 @@ jobs: if: matrix.os == 'windows-latest' run: pip install -r requirements-windows.txt - - name: Initialize installer environment - run: | - python -m venv .installer - source .installer/bin/activate - python -m pip install -r requirements.txt + - name: 📦 Packaging + run: bash ./package_antares_web.sh working-directory: scripts - - name: Build installer - run: | - bash ./package_antares_installer.sh - deactivate + - name: Add installer in package + run: bash ./package_antares_installer.sh working-directory: scripts - name: 📜 Install changelog requirements diff --git a/scripts/package_antares_installer.sh b/scripts/package_antares_installer.sh index 9e4cd713f2..e0e5fb351c 100644 --- a/scripts/package_antares_installer.sh +++ b/scripts/package_antares_installer.sh @@ -7,16 +7,34 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) PROJECT_DIR=$(dirname -- "${SCRIPT_DIR}") -INSTALLER_DIR="${PROJECT_DIR}/installer/src/antares_web_installer/" +INSTALLER_DIR="${PROJECT_DIR}/installer" +INSTALLER_SRC_DIR="${INSTALLER_DIR}/src/antares_web_installer" DIST_DIR="${PROJECT_DIR}/dist/package" +echo "INFO: Initializing the virtual environment .installer" +if [[ "$OSTYPE" == "msys"* ]]; then +# initialize environment on windows + python -m venv .installer + .installer/bin/Activate.ps1 + python -m pip install -r ${INSTALLER_DIR}/requirements.txt +else +# initialize environment on linux + python -m venv .installer + source .installer/bin/activate + python -m pip install -r ${INSTALLER_DIR}/requirements.txt +fi + +# build package echo "INFO: Generating the Installer for the Desktop application..." if [[ "$OSTYPE" == "msys"* ]]; then pushd ${PROJECT_DIR} - pyinstaller --onefile "${INSTALLER_DIR}gui/__main__.py" --distpath "${DIST_DIR}" --hidden-import antares_web_installer.shortcuts._linux_shell --hidden-import antares_web_installer.shortcuts._win32_shell --noconsole --name AntaresWebInstaller + pyinstaller --onefile "${INSTALLER_SRC_DIR}/gui/__main__.py" --distpath "${DIST_DIR}" --hidden-import antares_web_installer.shortcuts._linux_shell --hidden-import antares_web_installer.shortcuts._win32_shell --noconsole --name AntaresWebInstaller popd else pushd ${PROJECT_DIR} - pyinstaller --onefile "${INSTALLER_DIR}cli/__main__.py" --distpath "${DIST_DIR}" --hidden-import antares_web_installer.shortcuts._linux_shell --hidden-import antares_web_installer.shortcuts._win32_shell --noconsole --name AntaresWebInstallerCLI + pyinstaller --onefile "${INSTALLER_SRC_DIR}/cli/__main__.py" --distpath "${DIST_DIR}" --hidden-import antares_web_installer.shortcuts._linux_shell --hidden-import antares_web_installer.shortcuts._win32_shell --noconsole --name AntaresWebInstallerCLI popd fi + +deactivate +rm -r .installer \ No newline at end of file