diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cd2dd8e --- /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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 + with: + go-version: 1.25.x + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 + with: + version: '~> v2' + workdir: ./cmd/github-ci + args: release --clean + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore index a352569..f58c553 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea/ .vscode/ +dist/ coverage.out .github-ci.yaml /github-ci diff --git a/README.md b/README.md index a3feae7..5b50454 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ A CLI tool for managing GitHub Actions workflows. It helps lint workflows for be # Install go install github.com/reugn/github-ci/cmd/github-ci@latest +# Verify +github-ci --version + # Initialize config github-ci init @@ -60,6 +63,10 @@ go install github.com/reugn/github-ci/cmd/github-ci@latest Make sure `$GOPATH/bin` or `$GOBIN` is in your `$PATH`. +### From Releases + +Download the latest binary for your platform from [Releases](https://github.com/reugn/github-ci/releases). + ### From Source ```bash diff --git a/cmd/github-ci/.goreleaser.yml b/cmd/github-ci/.goreleaser.yml new file mode 100644 index 0000000..c0fc986 --- /dev/null +++ b/cmd/github-ci/.goreleaser.yml @@ -0,0 +1,61 @@ +version: 2 + +project_name: github-ci + +builds: + - main: . + ldflags: + - -s -w -X main.version={{ .Version }} + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +archives: + - name_template: >- + {{ .ProjectName }}_{{ .Version }}_ + {{- if eq .Os "darwin" }}macos + {{- else }}{{ .Os }}{{ end }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} + format_overrides: + - goos: windows + formats: [ 'zip' ] + +changelog: + use: github + format: "{{ .SHA }}: {{ .Message }}{{ with .AuthorUsername }} (@{{ . }}){{ end }}" + filters: + exclude: + - "^Merge pull request" + - "^Merge branch" + groups: + - title: "Features" + regexp: '^.*?feat(\([^)]+\))?!?:.+$' + order: 10 + - title: "Fixes" + regexp: '^.*?fix(\([^)]+\))?!?:.+$' + order: 20 + - title: "Improvements" + regexp: '^.*?(refactor|perf)(\([^)]+\))?!?:.+$' + order: 30 + - title: "Documentation updates" + regexp: '^.*?docs?(\([^)]+\))?!?:.+$' + order: 40 + - title: "Maintenance" + order: 999 + +checksum: + name_template: "checksums.txt" + +release: + draft: true + name_template: "v{{ .Version }}" + footer: >- + **Full Changelog**: + https://github.com/{{ .Env.GITHUB_REPOSITORY }}/compare/{{ .PreviousTag }}...{{ .Tag }} diff --git a/cmd/github-ci/main.go b/cmd/github-ci/main.go index 38ca4da..07d85d4 100644 --- a/cmd/github-ci/main.go +++ b/cmd/github-ci/main.go @@ -4,6 +4,10 @@ import ( "github.com/reugn/github-ci/internal/cmd" ) +// version is set by goreleaser via ldflags +var version = "dev" + func main() { + cmd.SetVersion(version) cmd.Execute() } diff --git a/docs/_includes/head_custom.html b/docs/_includes/head_custom.html index f3b13e1..596a812 100644 --- a/docs/_includes/head_custom.html +++ b/docs/_includes/head_custom.html @@ -6,7 +6,7 @@ document.documentElement.setAttribute('data-theme', jtdTheme); - +