Skip to content

Commit ea9bbea

Browse files
authored
feat: add version flag and release configuration (#18)
1 parent 7df5f70 commit ea9bbea

8 files changed

Lines changed: 117 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
22+
with:
23+
go-version: 1.25.x
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
27+
with:
28+
version: '~> v2'
29+
workdir: ./cmd/github-ci
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.idea/
22
.vscode/
33

4+
dist/
45
coverage.out
56
.github-ci.yaml
67
/github-ci

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ A CLI tool for managing GitHub Actions workflows. It helps lint workflows for be
3434
# Install
3535
go install github.com/reugn/github-ci/cmd/github-ci@latest
3636

37+
# Verify
38+
github-ci --version
39+
3740
# Initialize config
3841
github-ci init
3942

@@ -60,6 +63,10 @@ go install github.com/reugn/github-ci/cmd/github-ci@latest
6063

6164
Make sure `$GOPATH/bin` or `$GOBIN` is in your `$PATH`.
6265

66+
### From Releases
67+
68+
Download the latest binary for your platform from [Releases](https://github.com/reugn/github-ci/releases).
69+
6370
### From Source
6471

6572
```bash

cmd/github-ci/.goreleaser.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2
2+
3+
project_name: github-ci
4+
5+
builds:
6+
- main: .
7+
ldflags:
8+
- -s -w -X main.version={{ .Version }}
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
goarch:
16+
- amd64
17+
- arm64
18+
19+
archives:
20+
- name_template: >-
21+
{{ .ProjectName }}_{{ .Version }}_
22+
{{- if eq .Os "darwin" }}macos
23+
{{- else }}{{ .Os }}{{ end }}_
24+
{{- if eq .Arch "amd64" }}x86_64
25+
{{- else }}{{ .Arch }}{{ end }}
26+
format_overrides:
27+
- goos: windows
28+
formats: [ 'zip' ]
29+
30+
changelog:
31+
use: github
32+
format: "{{ .SHA }}: {{ .Message }}{{ with .AuthorUsername }} (@{{ . }}){{ end }}"
33+
filters:
34+
exclude:
35+
- "^Merge pull request"
36+
- "^Merge branch"
37+
groups:
38+
- title: "Features"
39+
regexp: '^.*?feat(\([^)]+\))?!?:.+$'
40+
order: 10
41+
- title: "Fixes"
42+
regexp: '^.*?fix(\([^)]+\))?!?:.+$'
43+
order: 20
44+
- title: "Improvements"
45+
regexp: '^.*?(refactor|perf)(\([^)]+\))?!?:.+$'
46+
order: 30
47+
- title: "Documentation updates"
48+
regexp: '^.*?docs?(\([^)]+\))?!?:.+$'
49+
order: 40
50+
- title: "Maintenance"
51+
order: 999
52+
53+
checksum:
54+
name_template: "checksums.txt"
55+
56+
release:
57+
draft: true
58+
name_template: "v{{ .Version }}"
59+
footer: >-
60+
**Full Changelog**:
61+
https://github.com/{{ .Env.GITHUB_REPOSITORY }}/compare/{{ .PreviousTag }}...{{ .Tag }}

cmd/github-ci/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import (
44
"github.com/reugn/github-ci/internal/cmd"
55
)
66

7+
// version is set by goreleaser via ldflags
8+
var version = "dev"
9+
710
func main() {
11+
cmd.SetVersion(version)
812
cmd.Execute()
913
}

docs/_includes/head_custom.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
document.documentElement.setAttribute('data-theme', jtdTheme);
77
</script>
88

9-
<!-- Theme stylesheets - disabled state set dynamically -->
9+
<!-- Theme stylesheets; JS toggles disabled state based on saved theme -->
1010
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-light.css' | relative_url }}" id="jtd-light">
1111
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-dark.css' | relative_url }}" id="jtd-dark">
1212
<script>

docs/install.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ go install github.com/reugn/github-ci/cmd/github-ci@latest
1717

1818
Make sure `$GOPATH/bin` or `$GOBIN` is in your `$PATH`.
1919

20+
## From Releases
21+
22+
Download the latest binary for your platform from [Releases](https://github.com/reugn/github-ci/releases).
23+
2024
## From Source
2125

2226
Clone the repository and build manually:
@@ -31,10 +35,11 @@ sudo mv github-ci /usr/local/bin/
3135
## Verify Installation
3236

3337
```bash
38+
github-ci --version
3439
github-ci --help
3540
```
3641

37-
You should see the available commands and options.
42+
You should see the version and the available commands.
3843

3944
## Authentication
4045

internal/cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ var rootCmd = &cobra.Command{
1414
SilenceErrors: true,
1515
}
1616

17+
// SetVersion sets the version string for the CLI.
18+
func SetVersion(version string) {
19+
rootCmd.Version = version
20+
}
21+
1722
func Execute() {
1823
if err := rootCmd.Execute(); err != nil {
1924
printError("%v", err)

0 commit comments

Comments
 (0)