diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de7a9f4..b7fe49c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,18 +40,17 @@ jobs: - uses: actions/setup-go@v5 with: go-version: 'stable' # The Go version to download (if necessary) and use. - - name: Make Build - id: make_build - env: - VERSION: ${{ steps.get_version.outputs.TAG }} + - name: Install objcopy for cross-arch binaries run: | - make all -s && ls build - - name: Release Upload Assets - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + sudo apt-get update + sudo apt-get install -y binutils binutils-aarch64-linux-gnu + GOVERSION=$(go version | awk '{print $3}') + echo "GOVERSION=${GOVERSION}" >> $GITHUB_ENV + - name: Build Binary + uses: goreleaser/goreleaser-action@v6 with: - draft: true - files: | - build/*.gz + distribution: goreleaser + version: '~> v2' + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..4acae9b --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,97 @@ +version: 2 + +project_name: wisp + +builds: + - id: archives-unix + main: . + binary: wisp + - flags: + - -trimpath + ldflags: + - -w -s + - -X 'github.com/jumpserver/wisp/cmd.Version={{ .Tag }}' + - -X 'github.com/jumpserver/wisp/cmd.BuildTime={{ .Date }}' + - -X 'github.com/jumpserver/wisp/cmd.GitCommit={{ .ShortCommit }}' + - -X 'github.com/jumpserver/wisp/cmd.GoVersion={{ .Env.GOVERSION }}' + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + - freebsd + - openbsd + - netbsd + goarch: + - amd64 + - arm64 + - mips64le + - ppc64le + - s390x + - riscv64 + - loong64 + + - id: linux-deb + main: . + binary: wisp + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + flags: + - -trimpath + ldflags: + - -s -w + - -X 'github.com/jumpserver/wisp/cmd.Version={{ .Tag }}' + - -X 'github.com/jumpserver/wisp/cmd.BuildTime={{ .Date }}' + - -X 'github.com/jumpserver/wisp/cmd.GitCommit={{ .ShortCommit }}' + - -X 'github.com/jumpserver/wisp/cmd.GoVersion={{ .Env.GOVERSION }}' + + hooks: + post: + - cmd: >- + {{- if eq .Arch "arm64" -}} + aarch64-linux-gnu-objcopy --remove-section .go.buildinfo "{{ .Path }}" + {{- else -}} + objcopy --remove-section .go.buildinfo "{{ .Path }}" + {{- end -}} + output: true + +archives: + - id: tarballs + ids: + - archives-unix + formats: + - tar.gz + name_template: >- + {{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }} + files: + - config_example.yml + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +nfpms: + - id: linux-packages + ids: + - linux-deb + package_name: wisp + formats: + - deb + file_name_template: >- + {{ .PackageName }}_linux_{{ .Arch }} + bindir: /usr/local/bin + maintainer: JumpServer Dev + description: Wisp is the communication component between JumpServer terminal services and the Core API. + homepage: https://github.com/jumpserver/wisp + +checksum: + name_template: checksums.txt + +changelog: + disable: true