From c4ba54f60db3d3a473cd170f5301ef9da3f30616 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 3 Nov 2022 13:55:22 -0400 Subject: [PATCH] cross-platform goreleaser; wip (#70) --- .github/workflows/release.yml | 85 +++++++++++++++++++++++- .goreleaser.yml => .goreleaser-linux.yml | 10 +-- .goreleaser-release.yml | 8 +++ .goreleaser-windows.yml | 10 +++ 4 files changed, 105 insertions(+), 8 deletions(-) rename .goreleaser.yml => .goreleaser-linux.yml (68%) create mode 100644 .goreleaser-release.yml create mode 100644 .goreleaser-windows.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3def8d02..c7add797 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,10 +3,10 @@ name: Release on: push: tags: - - '*' + - 'v*.*.*' jobs: - release-build: + build-linux: runs-on: ubuntu-latest steps: - run: sudo apt-get install gcc-multilib g++-multilib @@ -38,6 +38,85 @@ jobs: with: distribution: goreleaser version: latest - args: release --rm-dist + args: release --skip-publish --config .goreleaser-linux.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: action/upload-artifact@v3 + with: + name: zrok-linux + path: dist/zrok* + + build-windows: + runs-on: ubuntu-latest + steps: + - run: sudo apt-get install gcc-mingw-w64-x86-64 + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - run: git fetch --force --tags + + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.3' + cache: true + + - uses: actions/setup-node@v3 + with: + node-version: 16.x + + - run: npm install + working-directory: ui + + - run: npm run build + working-directory: ui + env: + CI: "" + + - uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --skip-publish --config .goreleaser-windows.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: action/upload-artifact@v3 + with: + name: zrok-windows + path: dist/zrok* + + publish-release: + needs: [build-linux, build-windows] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - run: | + mkdir -p ./zrok-build/linux + mkdir -p ./zrok-build/windows + + - uses: actions/download-artifact@v3 + with: + name: zrok-linux + path: ./zrok-build/linux + + - uses: actions/download-artifact@v3 + with: + name: zrok-windows + path: ./zrok-build/windows + + - run: | + cd ./zrok-build + cat ./linux/zrok*checksums.txt >> checksums.txt + cat ./windows/zrok*checksums.txt >> checksums.txt + rm ./linux/zrok*checksums.txt + rm ./windows/zrok*checksums.txt + + - uses: goreleaser/goreleaser-action@v3 + with: + args: release --config .goreleaser-release.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser-linux.yml similarity index 68% rename from .goreleaser.yml rename to .goreleaser-linux.yml index 98c4e597..77cd695b 100644 --- a/.goreleaser.yml +++ b/.goreleaser-linux.yml @@ -1,9 +1,9 @@ builds: - main: ./cmd/zrok ldflags: "-s -w -X github.com/openziti-test-kitchen/zrok/build.Version={{.Tag}} -X github.com/openziti-test-kitchen/zrok/build.Hash={{.ShortCommit}}" - ignore: - - goarch: arm - - goarch: arm64 - - goos: darwin env: - - CGO_ENABLED=1 \ No newline at end of file + - CGO_ENABLED=1 + goos: + - linux + goarch: + - amd64 \ No newline at end of file diff --git a/.goreleaser-release.yml b/.goreleaser-release.yml new file mode 100644 index 00000000..ed7b167e --- /dev/null +++ b/.goreleaser-release.yml @@ -0,0 +1,8 @@ +builds: + - skip: true +release: + draft: true + mode: append + extra_files: + - glob: ./zrok-build/**/* + - glob: ./zrok-build/checksums.txt \ No newline at end of file diff --git a/.goreleaser-windows.yml b/.goreleaser-windows.yml new file mode 100644 index 00000000..fb4b49ca --- /dev/null +++ b/.goreleaser-windows.yml @@ -0,0 +1,10 @@ +builds: +- main: ./cmd/zrok + ldflags: "-s -w -X github.com/openziti-test-kitchen/zrok/build.Version={{.Tag}} -X github.com/openziti-test-kitchen/zrok/build.Hash={{.ShortCommit}}" + env: + - CGO_ENABLED=1 + - CC=/usr/bin/x86_64-w64-mingw32-gcc + goos: + - windows + goarch: + - amd64 \ No newline at end of file