From 7c7328424d4d406e04d50289ccce54639c964d15 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 18 Mar 2024 20:02:36 +0800 Subject: [PATCH] update: go releaser github --- .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++ .goreleaser.yaml | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e0cfbb9 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Release + +on: + push: + tags: + - 'v*' +env: + GO_VERSION: 1.21 + +permissions: write-all + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout Source Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Go Environment + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --rm-dist + env: + CGO_ENABLED: 0 + # GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..73cc891 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,41 @@ +project_name: k8spider + +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - darwin + - windows + - linux + goarch: + - "386" + - amd64 + - arm64 +archives: + - name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}" + files: + - README.md + - CHANGELOG.md + - LICENSE + - docs/* + - images/* + format_overrides: + - goos: windows + format: zip + +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ incpatch .Version }}" +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^doc:" + - "^ci:" + - "^Merge pull request" \ No newline at end of file