diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 518b4a2..1c6fbd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index 1264f61..a76d976 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ example/ temp/ hk hk.exe +hk-* +hk.msi diff --git a/bootstrap/hk.wxs b/bootstrap/hk.wxs new file mode 100644 index 0000000..9423097 --- /dev/null +++ b/bootstrap/hk.wxs @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hitch/key.py b/hitch/key.py index 9c9ea7d..3ce574f 100644 --- a/hitch/key.py +++ b/hitch/key.py @@ -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)