From e3a7c242d8d93be9f6c6d42f4041eff661c34fe0 Mon Sep 17 00:00:00 2001 From: sincerefly Date: Wed, 10 Apr 2024 11:49:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20github=20action=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=20Release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ scripts/xcompile.sh | 13 +++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 scripts/xcompile.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3128a02 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release EasyCmd +on: + push: + tags: + - 'v0.*' + - 'draft-*' + +jobs: + publishGitRelease: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '^1.20' + check-latest: true + + - name: Cross compile + run: | + sudo apt-get install rhash -y + go install github.com/mitchellh/gox@v1.0.1 + mkdir -p build + ./scripts/xcompile.sh + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: build/* + draft: true + fail_on_unmatched_files: true diff --git a/scripts/xcompile.sh b/scripts/xcompile.sh new file mode 100644 index 0000000..9787b2d --- /dev/null +++ b/scripts/xcompile.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e +# you may need to go install github.com/mitchellh/gox@v1.0.1 first +echo $VERSION +CGO_ENABLED=0 gox -ldflags "-s -w ${LDFLAGS}" -output="build/easycmd_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm linux/arm64" + +cd build + +rhash -r -a . -o checksums + +rhash -r -a --bsd . -o checksums-bsd + +rhash --list-hashes > checksums_hashes_order