diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 0000000..9961982 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,53 @@ +# This is a basic workflow that is manually triggered + +name: Build dist exe + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. - maybe use this to specify something like Python version? + inputs: + software_version: + description: 'Release version number - e.g. 1.5.1' + required: true + software_version_without_dots: + description: 'Same as above but no dots - e.g. 150' + required: true + python_version: + description: 'Python version to use' + default: '3.10' + required: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # single job called 'build' for entire run + build: + # The type of runner that the job will run on + runs-on: windows-2019 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/setup-python@v3 + with: + python-version: ${{ github.event.inputs.python_version }} + architecture: 'x64' + # Runs a single command using the runners shell + - name: Check Python Version + run: python --version ; pip --version + - name: Install build dependencies + run: choco install -y git wget sed + - name: Install cx_freeze + run: python -m pip install --upgrade cx_Freeze + - name: Install innosetup + run: wget "https://jrsoftware.org/download.php/is.exe?site=1" -o wget_output -O innosetup.exe ; .\innosetup.exe /SILENT + - name: Build executables + run: git clone -b ${env:GITHUB_REF_NAME} https://github.com/kco-uga/ASpace_Batch_Export-Cleanup-Upload.git ; cd ASpace_Batch_Export-Cleanup-Upload ; pip install -r requirements.txt ; sed -i "s/DEVELOPMENT/${{ github.event.inputs.software_version }}/g" as_xtf_GUI.py ; python cx_freeze.py build + - name: Bundle package with innosetup + run: cd ASpace_Batch_Export-Cleanup-Upload ; Rename-Item -Path "build\exe.win-amd64-${{ github.event.inputs.python_version }}\ASpace_Batch_Export_vRELEASEVERSIONNUMBERNODOTS.exe" -NewName "ASpace_Batch_Export_v${{ github.event.inputs.software_version_without_dots }}.exe" ; sed -i "s/RELEASEVERSIONNUMBERNODOTS/${{ github.event.inputs.software_version_without_dots }}/g" as_xtf.iss ; sed -i "s/RELEASEVERSIONNUMBER/${{ github.event.inputs.software_version }}/" as_xtf.iss ; sed -i "s/PYTHONVERSION/${{ github.event.inputs.python_version }}/" as_xtf.iss ; iscc as_xtf.iss + - name: Try to make files available as artifacts - output_dir + uses: actions/upload-artifact@v3 + with: + name: output_dir + path: ASpace_Batch_Export-Cleanup-Upload/Output + diff --git a/as_xtf.iss b/as_xtf.iss new file mode 100644 index 0000000..e60c358 --- /dev/null +++ b/as_xtf.iss @@ -0,0 +1,62 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "ArchivesSpace Batch Exporter" +#define MyAppVersion "RELEASEVERSIONNUMBER" +#define MyAppPublisher "University of Georgia" +#define MyAppURL "https://github.com/uga-libraries/ASpace_Batch_Export-Cleanup-Upload" +#define MyAppExeName "ASpace_Batch_Export_vRELEASEVERSIONNUMBERNODOTS.exe" +#define MyAppAssocName MyAppName + "" +#define MyAppAssocExt ".exe" +#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt +#define OutputBaseFilename "asbatch-vRELEASEVERSIONNUMBERNODOTS" +#define LicenseLocation "D:\a\ASpace_Batch_Export-Cleanup-Upload\ASpace_Batch_Export-Cleanup-Upload\ASpace_Batch_Export-Cleanup-Upload\LICENSE.txt" +#define EXESource "D:\a\ASpace_Batch_Export-Cleanup-Upload\ASpace_Batch_Export-Cleanup-Upload\ASpace_Batch_Export-Cleanup-Upload\build\exe.win-amd64-PYTHONVERSION" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{7B0A7234-3843-4BBC-98D8-88E30ECBBB8B} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={autopf}\{#MyAppName} +ChangesAssociations=yes +DisableProgramGroupPage=yes +LicenseFile={#LicenseLocation} +; Remove the following line to run in administrative install mode (install for all users.) +PrivilegesRequired=lowest +PrivilegesRequiredOverridesAllowed=commandline +OutputBaseFilename={#OutputBaseFilename} +Compression=lzma +SolidCompression=yes +WizardStyle=modern + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "{#EXESource}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Registry] +Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0" +Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" +Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" + +[Icons] +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + diff --git a/cx_freeze.py b/cx_freeze.py new file mode 100644 index 0000000..8bd377d --- /dev/null +++ b/cx_freeze.py @@ -0,0 +1,20 @@ +import sys +from cx_Freeze import setup, Executable + +# Dependencies are automatically detected, but it might need fine tuning. +# "packages": ["os"] is used as example only +build_exe_options = {"packages": ["os"], "excludes": [], "includes": ["PySimpleGUI","loguru","lxml","paramiko","scp","asnake","requests"]} +includefiles = ["thumbnail.ico"] + +# base="Win32GUI" should be used only for Windows GUI app +base = None +if sys.platform == "win32": + base = "Win32GUI" + +setup( + name="ASpace_Batch_Export", + version="0.1", + description="Aspace Batch Export", + options={"build_exe": build_exe_options}, + executables=[Executable("as_xtf_GUI.py", base=base, targetName="ASpace_Batch_Export_vRELEASEVERSIONNUMBERNODOTS.exe", icon="thumbnail.ico")], +)