From afec0cb75d4235485a9dcdda17b5768c28d59ef4 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:04:42 -0400 Subject: [PATCH 1/6] build for Windows --- build/build.go | 1 + 1 file changed, 1 insertion(+) diff --git a/build/build.go b/build/build.go index 81eaecb..cfa5304 100644 --- a/build/build.go +++ b/build/build.go @@ -22,6 +22,7 @@ var targets = map[string][]string{ "linux": {"386", "amd64", "arm", "arm64"}, "netbsd": {"386", "amd64"}, "openbsd": {"386", "amd64"}, + "windows": {"386", "amd64"}, } type buildOptions struct { From 97e1384669e076ee391f2fb0842f9b5de60a64d9 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Thu, 29 Apr 2021 14:03:24 -0400 Subject: [PATCH 2/6] Windows build: include .exe and compress with zip --- build/build.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/build/build.go b/build/build.go index cfa5304..a84c528 100644 --- a/build/build.go +++ b/build/build.go @@ -10,7 +10,7 @@ import ( "path" "path/filepath" "sync" - + "strings" "github.com/cupcakearmy/autorestic/internal" ) @@ -32,6 +32,12 @@ type buildOptions struct { func build(options buildOptions, wg *sync.WaitGroup) { fmt.Printf("Building %s %s\n", options.Target, options.Arch) out := fmt.Sprintf("autorestic_%s_%s_%s", options.Version, options.Target, options.Arch) + + // append .exe for Windows + if (options.Target == "windows") { + out += ".exe" + } + out = path.Join(DIR, out) out, _ = filepath.Abs(out) fmt.Println(out) @@ -54,7 +60,17 @@ func build(options buildOptions, wg *sync.WaitGroup) { // Compress { - c := exec.Command("bzip2", out) + var c *exec.Cmd + switch options.Target { + // use zip for Windows + case "windows": + zipFile := strings.TrimSuffix(out, ".exe") + ".zip" + c = exec.Command("zip", "-q", "-X", zipFile, out) + // use bzip2 for everything else + default: + c = exec.Command("bzip2", out) + } + c.Dir = DIR c.Stdout = os.Stdout c.Stderr = os.Stderr From b711b68433155b1aa880db6069d297056f96af90 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Thu, 29 Apr 2021 14:15:32 -0400 Subject: [PATCH 3/6] only release bz2 and zip --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e82998f..82a9549 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,6 +51,8 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - files: dist/* + files: | + dist/*.bz2 + dist/*.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b9d7a8991593b3093c380ceac4e2e5f7d92288f9 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Thu, 29 Apr 2021 14:27:54 -0400 Subject: [PATCH 4/6] fix zip archive --- build/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.go b/build/build.go index a84c528..143aa05 100644 --- a/build/build.go +++ b/build/build.go @@ -65,7 +65,7 @@ func build(options buildOptions, wg *sync.WaitGroup) { // use zip for Windows case "windows": zipFile := strings.TrimSuffix(out, ".exe") + ".zip" - c = exec.Command("zip", "-q", "-X", zipFile, out) + c = exec.Command("zip", "-j", "-q", "-X", zipFile, out) // use bzip2 for everything else default: c = exec.Command("bzip2", out) From 852ecc1e1a37d8cb6151af4cf7383381de9feaa8 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Fri, 7 May 2021 11:07:27 -0400 Subject: [PATCH 5/6] release SHA256SUMS --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82a9549..2b6d9ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,5 +54,6 @@ jobs: files: | dist/*.bz2 dist/*.zip + dist/SHA256SUMS env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 02163fb2d33521cc4070ca5df5f2c9860b91f983 Mon Sep 17 00:00:00 2001 From: Chris Xiao <30990835+chrisx8@users.noreply.github.com> Date: Sat, 12 Mar 2022 15:19:29 -0500 Subject: [PATCH 6/6] disable Docker build for the fork ***when merging. please REVERT THIS COMMIT! --- .github/workflows/build.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b6d9ee..f54d7f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,34 +6,6 @@ on: - "v*.*.*" jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Docker Labels - id: meta - uses: crazy-max/ghaction-docker-meta@v2 - with: - images: cupcakearmy/autorestic - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - release: runs-on: ubuntu-latest steps: