diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9492ae..ae9a78e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,9 @@ name: build on: - push: - tags: - - "v*" - # pull_request: - # branches: - # - main + pull_request: + branches: + - main jobs: build-and-test: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 0ee4d53..89744b1 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -68,6 +68,42 @@ jobs: name: cibw-sdist path: dist/*.tar.gz + build_installer: + name: Build Windows Installer + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + pip install pyinstaller + pip install .[MT5] + + - name: Build executable + run: pyinstaller tcopier.spec + + - name: Replace version in Inno Setup script + run: | + $version = "${{ github.ref_name }}".Substring(1) + (Get-Content tcopier.iss) -replace '__VERSION__', $version | Set-Content tcopier.iss + + - name: Install Inno Setup + uses: Minionguyj/inno-setup-action@v2.2.2 + + - name: Compile installer + run: iscc tcopier.iss + + - name: Upload installer artifact + uses: actions/upload-artifact@v4 + with: + name: installer + path: "**/TradeCopier.exe" + + publish: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest @@ -84,3 +120,21 @@ jobs: with: user: __token__ password: ${{ secrets.BBSTRADER_PYPI_API_TOKEN }} + + release: + name: Create GitHub Release + needs: [build_installer, publish] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: dist/* diff --git a/.gitignore b/.gitignore index 092cce4..7caaf7c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ notes.txt *.h5 *ipynb_checkpoints/ *.exe -*.iss cmd.ps1 .vscode CMakePresets.json diff --git a/tcopier.iss b/tcopier.iss new file mode 100644 index 0000000..e57de98 --- /dev/null +++ b/tcopier.iss @@ -0,0 +1,25 @@ +[Setup] +AppName=TradeCopier +AppVersion=2.0.2 +AppPublisher=bbstrading +DefaultDirName={pf}\TradeCopier +DefaultGroupName=TradeCopier +OutputDir=. +OutputBaseFilename=TradeCopier +Compression=lzma +SolidCompression=yes +LicenseFile=LICENSE +SetupIconFile=bbstrader\assets\bbstrader.ico + +[Files] +Source: "dist\tcopier.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "bbstrader\assets\bbstrader.ico"; DestDir: "{app}"; Flags: ignoreversion +[Icons] +Name: "{group}\TradeCopier"; Filename: "{app}\tcopier.exe"; IconFilename: "{app}\bbstrader.ico" +Name: "{group}\Uninstall tradecopier"; Filename: "{uninstallexe}" +Name: "{commondesktop}\tradecopier"; Filename: "{app}\tcopier.exe"; IconFilename: "{app}\bbstrader.ico"; Tasks: desktopicon + + + +[Tasks] +Name: "desktopicon"; Description: "Create a &desktop shortcut"; GroupDescription: "Additional icons:"