forked from gitea/gitea-mcp
 ci: integrate GoReleaser for streamlined release management
- Rename job from `release` to `goreleaser` in `release-tag.yml` - Change the tag pattern from `' * '` to `" * "` in `release-tag.yml` - Update job steps to better describe their actions in `release-tag.yml` - Replace build steps with GoReleaser action steps in `release-tag.yml` - Add configuration file `.goreleaser.yaml` for GoReleaser - Include hooks, builds, archives, changelog sorting, and release footer in `.goreleaser.yaml` Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
 | @@ -1,41 +1,32 @@ | ||||
| name: release | ||||
|  | ||||
| on:  | ||||
| on: | ||||
|  push: | ||||
|  tags: | ||||
|  - '*' | ||||
|  - "*" | ||||
|  | ||||
| jobs: | ||||
|  release: | ||||
|  goreleaser: | ||||
|  runs-on: ubuntu-latest | ||||
|  steps: | ||||
|  - uses: actions/checkout@v4 | ||||
|  - name: Checkout | ||||
|  uses: actions/checkout@v4 | ||||
|  with: | ||||
|  fetch-depth: 0 | ||||
|  - name: setup go | ||||
|  - name: Set up Go | ||||
|  uses: actions/setup-go@v5 | ||||
|  with: | ||||
|  go-version-file: 'go.mod' | ||||
|  - name: release-build | ||||
|  run: go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-linux-amd64 | ||||
|  - name: release-build-windows | ||||
|  run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-windows-amd64.exe | ||||
|  - name: release-build-darwin | ||||
|  run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-darwin-amd64 | ||||
|  - name: release-build-arm64 | ||||
|  run: GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-linux-arm64 | ||||
|  - name: release-build-windows-arm64 | ||||
|  run: GOOS=windows GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-windows-arm64.exe | ||||
|  - name: release-build-darwin-arm64 | ||||
|  run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-darwin-arm64 | ||||
|  | ||||
|  - name: Use Go Action  | ||||
|  id: use-go-action | ||||
|  uses: https://gitea.com/actions/gitea-release-action@main | ||||
|  go-version: stable | ||||
|  - name: Run GoReleaser | ||||
|  uses: goreleaser/goreleaser-action@v6 | ||||
|  with: | ||||
|  files: |- | ||||
|   bin/** | ||||
|  token: '${{secrets.RELEASE_TOKEN}}' | ||||
|  distribution: goreleaser | ||||
|  # 'latest', 'nightly', or a semver | ||||
|  version: "~> v2" | ||||
|  args: release --clean | ||||
|  env: | ||||
|  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|  | ||||
|  release-image: | ||||
|  runs-on: ubuntu-latest | ||||
|  env: | ||||
|   | ||||
   	66   .goreleaser.yaml  Normal file    
 	66  
 .goreleaser.yaml  Normal file  | @@ -0,0 +1,66 @@ | ||||
| # yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||||
|  | ||||
| version: 2 | ||||
|  | ||||
| before: | ||||
|  hooks: | ||||
|  - go mod tidy | ||||
|  | ||||
| builds: | ||||
|  - env: | ||||
|  - CGO_ENABLED=0 | ||||
|  main: . | ||||
|  goos: | ||||
|  - linux | ||||
|  - windows | ||||
|  - darwin | ||||
|  | ||||
| archives: | ||||
|  - formats: tar.gz | ||||
|  # this name template makes the OS and Arch compatible with the results of `uname`. | ||||
|  name_template: >- | ||||
|  {{ .ProjectName }}_ | ||||
|  {{- title .Os }}_ | ||||
|  {{- if eq .Arch "amd64" }}x86_64 | ||||
|  {{- else if eq .Arch "386" }}i386 | ||||
|  {{- else }}{{ .Arch }}{{ end }} | ||||
|  {{- if .Arm }}v{{ .Arm }}{{ end }} | ||||
|  # use zip for windows archives | ||||
|  format_overrides: | ||||
|  - goos: windows | ||||
|  formats: zip | ||||
|  | ||||
| changelog: | ||||
|  sort: asc | ||||
|  groups: | ||||
|  - title: Features | ||||
|  regexp: "^.*feat[(\\w)]*:+.*$" | ||||
|  order: 0 | ||||
|  - title: "Bug fixes" | ||||
|  regexp: "^.*fix[(\\w)]*:+.*$" | ||||
|  order: 1 | ||||
|  - title: "Enhancements" | ||||
|  regexp: "^.*chore[(\\w)]*:+.*$" | ||||
|  order: 2 | ||||
|  - title: "Refactor" | ||||
|  regexp: "^.*refactor[(\\w)]*:+.*$" | ||||
|  order: 3 | ||||
|  - title: "Build process updates" | ||||
|  regexp: ^.*?(build|ci)(\(.+\))??!?:.+$ | ||||
|  order: 4 | ||||
|  - title: "Documentation updates" | ||||
|  regexp: ^.*?docs?(\(.+\))??!?:.+$ | ||||
|  order: 4 | ||||
|  - title: Others | ||||
|  order: 999 | ||||
|  filters: | ||||
|  exclude: | ||||
|  - "^docs:" | ||||
|  - "^test:" | ||||
|  | ||||
| release: | ||||
|  footer: >- | ||||
|  | ||||
|  --- | ||||
|  | ||||
|  Released by [GoReleaser](https://github.com/goreleaser/goreleaser). | ||||
	Reference in New Issue 
 Block a user