From 3288a7f2eec2bbd0368cda76e761253295f3b53e Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Mon, 16 Jan 2023 20:27:27 +0100 Subject: [PATCH 1/3] Add GoReleaser file --- .goreleaser.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .goreleaser.yaml diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..6023bd0 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,22 @@ +project_name: irestore +builds: + - id: darwin-build + main: ./cmd/irestore + env: + - CGO_ENABLED=1 + goos: + - darwin + - id: windows-build + main: ./cmd/irestore + ldflags: -buildmode=exe + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + goos: + - windows + goarch: + - amd64 + +checksum: + name_template: 'checksums.txt' From f40078fe7b44bd6d4443baaecf65e090a91e10b7 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Mon, 16 Jan 2023 20:27:33 +0100 Subject: [PATCH 2/3] Add GitHub Action --- .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5366ed8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,24 @@ +on: + push: + tags: + - "v*.*.*" + +jobs: + goreleaser: + runs-on: macos-latest + permissions: write-all + steps: + - uses: actions/checkout@v3 + - run: git fetch --force --tags + - run: brew install mingw-w64 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.1' + cache: true + - uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 456931fe35b0152746fbe3b464d2e4f1786853b0 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Fri, 28 Apr 2023 20:28:23 +0200 Subject: [PATCH 3/3] Add cross compilation support for Windows --- .github/workflows/release.yaml | 5 +++++ .goreleaser.yaml | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5366ed8..d7d5265 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,6 +11,11 @@ jobs: - uses: actions/checkout@v3 - run: git fetch --force --tags - run: brew install mingw-w64 + - working-directory: /tmp + run: | + wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230427/llvm-mingw-20230427-ucrt-macos-universal.tar.xz + gunzip llvm-mingw-20230427-ucrt-macos-universal.tar.xz + tar xf llvm-mingw-20230427-ucrt-macos-universal.tar - uses: actions/setup-go@v3 with: go-version: '>=1.19.1' diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6023bd0..7bf70c1 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,7 @@ builds: - CGO_ENABLED=1 goos: - darwin - - id: windows-build + - id: windows-build-amd64 main: ./cmd/irestore ldflags: -buildmode=exe env: @@ -17,6 +17,28 @@ builds: - windows goarch: - amd64 + - id: windows-build-arm64 + main: ./cmd/irestore + ldflags: -buildmode=exe + env: + - CGO_ENABLED=1 + - CC=/tmp/llvm-mingw-20230427-ucrt-macos-universal/bin/aarch64-w64-mingw32-gcc + - CXX=/tmp/llvm-mingw-20230427-ucrt-macos-universal/bin/aarch64-w64-mingw32-g++ + goos: + - windows + goarch: + - arm64 + - id: windows-build-386 + main: ./cmd/irestore + ldflags: -buildmode=exe + env: + - CGO_ENABLED=1 + - CC=i686-w64-mingw32-gcc + - CXX=i686-w64-mingw32-g++ + goos: + - windows + goarch: + - 386 checksum: name_template: 'checksums.txt'