Skip to content

Commit

Permalink
FEATURE : Build MSI for windows version of hk.exe.
Browse files Browse the repository at this point in the history
  • Loading branch information
crdoconnor committed Jan 10, 2021
1 parent 55d87d5 commit 1508abd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ on:
jobs:
generate:
name: Generate cross-platform builds
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Generate build files
uses: thatisuday/go-cross-build@v1
with:
platforms: 'linux/amd64, darwin/amd64, windows/amd64'
package: 'hk.go'
name: 'hk'
compress: 'false'
dest: 'dist'

- name: Install dependencies
run: |
#sudo apt-get update
#sudo apt-get upgrade -y
sudo apt-get install python3-virtualenv build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
sudo apt-get install golang wixl msitools -y
sudo pip install hitchkey
- name: Build multiarch
run: hk multiarch

- name: Upload build-artifacts
uses: skx/github-action-publish-binaries@master
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ example/
temp/
hk
hk.exe
hk-*
hk.msi
32 changes: 32 additions & 0 deletions bootstrap/hk.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='HitchKey 0.7.0' Id='13AB1D01-BB41-4013-B796-C6CEBBD50A19' UpgradeCode='B27B57D6-8A59-44CD-8E79-329091C3B701'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='HitchDev'>

<Package Id='*' Keywords='Installer' Description="HitchKey Installer"
Comments='' Manufacturer='HitchDev'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="HitchKey Installation [1]" />

<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='HitchKey' Name='HitchKey'>
<Directory Id='INSTALLDIR' Name='HitchKey'>

<Component Id='MainExecutable' Guid='ABCDDCBA-83F1-4F22-985B-FDB3C8ABD471'>
<File Id='hk.exe' Name='hk.exe' DiskId='1' Source='hk.exe' KeyPath='yes'/>
</Component>

</Directory>
</Directory>
</Directory>
</Directory>

<Feature Id='Complete' Level='1'>
<ComponentRef Id='MainExecutable' />
</Feature>

</Product>
</Wix>
25 changes: 25 additions & 0 deletions hitch/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,28 @@ def dogfoodhk():
Command("go")("build", "-ldflags=-s -w", "hk.go").in_dir(bootstrap_path).run()
bootstrap_path.joinpath("hk").copy("/home/colm/bin/hk")

@expected(CommandError)
def multiarch():
"""Build hk for multiple architectures."""
bootstrap_path = DIR.project / "bootstrap"
dist_path = DIR.project / "dist"

if not dist_path.exists():
dist_path.mkdir()

go = Command("go").in_dir(bootstrap_path)
print("Building for linux...")
go("build", "-o", "hk-linux-amd64", "-ldflags=-s -w", "hk.go").with_env(GOOS="linux", GOARCH="amd64").run()
bootstrap_path.joinpath("hk-linux-amd64").copy(dist_path)

print("Building for mac...")
go("build", "-o", "hk-darwin-amd64", "-ldflags=-s -w", "hk.go").with_env(GOOS="darwin", GOARCH="amd64").run()
bootstrap_path.joinpath("hk-darwin-amd64").copy(dist_path)

print("Building for windows...")
go("build", "-o", "hk.exe", "-ldflags=-s -w", "hk.go").with_env(GOOS="linux", GOARCH="amd64").run()
bootstrap_path.joinpath("hk.exe").copy(dist_path)

print("Building MSI For windows...")
Command("wixl", "-v", "hk.wxs").in_dir(bootstrap_path).run()
bootstrap_path.joinpath("hk.msi").copy(dist_path)

0 comments on commit 1508abd

Please sign in to comment.