-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from misdoro/gh_actions
Build and publish windows installer binary on tag releases
- Loading branch information
Showing
4 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: PyInstaller Windows | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U https://github.com/pyinstaller/pyinstaller/archive/develop.zip | ||
pip install -r requirements.txt | ||
- name: build with pyinstaller | ||
run: | | ||
pyinstaller px100.spec | ||
- name: Build NSIS installer package | ||
run: | | ||
makensis -VERSION | ||
makensis px100.nsi | ||
- name: Upload installer artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: installer | ||
path: Install* | ||
release: | ||
name: Upload Release Asset | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Download installer artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: installer | ||
- name: List files | ||
run: | | ||
ls -l | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: Install Battery tester PX100.exe | ||
asset_name: Battery-Tester-PX100.exe | ||
asset_content_type: application/exe |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Basic installer for battery tester | ||
*/ | ||
|
||
!define NAME "Battery tester PX100" | ||
!define REGPATH_UNINSTSUBKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" | ||
Name "${NAME}" | ||
OutFile "Install ${NAME}.exe" | ||
Unicode True | ||
RequestExecutionLevel User ; We don't need UAC elevation | ||
InstallDir "" ; Don't set a default $InstDir so we can detect /D= and InstallDirRegKey | ||
InstallDirRegKey HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString" | ||
|
||
!include LogicLib.nsh | ||
!include WinCore.nsh | ||
!include Integration.nsh | ||
|
||
Page Directory | ||
Page InstFiles | ||
|
||
Uninstpage UninstConfirm | ||
Uninstpage InstFiles | ||
|
||
|
||
Function .onInit | ||
SetShellVarContext Current | ||
|
||
${If} $InstDir == "" ; No /D= nor InstallDirRegKey? | ||
GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles} ; This folder only exists on Win7+ | ||
StrCmp $InstDir "" 0 +2 | ||
StrCpy $InstDir "$LocalAppData\Programs" ; Fallback directory | ||
|
||
StrCpy $InstDir "$InstDir\$(^Name)" | ||
${EndIf} | ||
FunctionEnd | ||
|
||
Function un.onInit | ||
SetShellVarContext Current | ||
FunctionEnd | ||
|
||
Section "Program files (Required)" | ||
SectionIn Ro | ||
|
||
SetOutPath $InstDir | ||
WriteUninstaller "$InstDir\Uninst.exe" | ||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayName" "${NAME}" | ||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayIcon" "$InstDir\MyApp.exe,0" | ||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString" '"$InstDir\Uninst.exe"' | ||
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoModify" 1 | ||
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoRepair" 1 | ||
|
||
File /r dist\px100\* | ||
SectionEnd | ||
|
||
Section "Start Menu shortcut" | ||
CreateShortcut "$SMPrograms\${NAME}.lnk" "$InstDir\px100.exe" | ||
SectionEnd | ||
|
||
Section -Uninstall | ||
${UnpinShortcut} "$SMPrograms\${NAME}.lnk" | ||
Delete "$SMPrograms\${NAME}.lnk" | ||
|
||
Delete "$InstDir\MyApp.exe" | ||
Delete "$InstDir\Uninst.exe" | ||
RMDir "$InstDir" | ||
DeleteRegKey HKCU "${REGPATH_UNINSTSUBKEY}" | ||
SectionEnd |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis(['main.py'], | ||
pathex=['./'], | ||
binaries=[], | ||
datas=[('gui/*.ui', 'gui') ], | ||
hiddenimports=['pyvisa_py','pyserial'], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False) | ||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='px100', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True ) | ||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='px100') |