From c2ec31d5a6714ad581bfb89be50965cc256f10c5 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Fri, 22 Nov 2024 18:31:18 +0800 Subject: [PATCH 1/2] use go@1.21 --- go.mod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 15e8099..ec54250 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/gotray/got -go 1.23.3 +go 1.21 + +toolchain go1.23.3 require ( github.com/fatih/color v1.18.0 From d80e7a11731f96a82113a403627a5d1759b2593f Mon Sep 17 00:00:00 2001 From: Li Jie Date: Fri, 22 Nov 2024 18:32:02 +0800 Subject: [PATCH 2/2] build with goreleaser --- .github/workflows/release.yml | 32 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe5b8b0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..713be55 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,32 @@ +before: + hooks: + - go mod tidy + +builds: + - id: got + main: ./cmd/got + binary: got + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +archives: + - format: tar.gz + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^ci:' + - Merge pull request + - Merge branch \ No newline at end of file