Skip to content

Commit 567dcae

Browse files
committed
feat(adptool): add release workflow and binary distribution
- Add GitHub Actions workflow for releasing new versions - Implement GoReleaser configuration for building and distributing binaries - Update README with new installation instructions for pre-compiled binaries - Simplify command usage in README examples
1 parent e2a90b3 commit 567dcae

File tree

3 files changed

+86
-10
lines changed

3 files changed

+86
-10
lines changed

.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@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: 1.23
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v5
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# .goreleaser.yaml
2+
project_name: adptool
3+
4+
builds:
5+
- id: adptool
6+
main: ./cmd/adptool
7+
binary: adptool
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
- darwin
14+
goarch:
15+
- amd64
16+
- arm64
17+
ignore:
18+
- goos: windows
19+
goarch: arm64
20+
21+
archives:
22+
- id: adptool
23+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
24+
format_overrides:
25+
- goos: windows
26+
format: zip
27+
28+
release:
29+
github:
30+
owner: origadmin
31+
name: adptool
32+
draft: true
33+
34+
checksum:
35+
name_template: 'checksums.txt'
36+
37+
snapshot:
38+
name_template: "{{ .Tag }}-next"
39+
40+
changelog:
41+
sort: asc
42+
filters:
43+
exclude:
44+
- '^docs:'
45+
- '^test:'

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ method proxies based on a clear and powerful configuration system.
1010
- **Eliminate Boilerplate**: Automate the generation of repetitive adapter code.
1111
- **Improve Maintainability**: Adapt to upstream changes by modifying configuration, not manual code.
1212

13-
## Core Concept: Configuration-Driven Generation
14-
15-
`adptool` operates on a simple yet powerful principle: **Your configuration drives the code generation.** You define
16-
*what* to adapt and *how* to adapt it in a single, well-structured YAML file. The tool then parses your Go source code
17-
to apply these rules, generating the necessary adapter code automatically.
1813

1914
## Installation
2015

21-
Ensure you have Go 1.23 or higher installed.
16+
### Using Go install
2217

23-
```sh
18+
```bash
2419
go install github.com/origadmin/adptool/cmd/adptool@latest
2520
```
2621

22+
### Download pre-compiled binaries
23+
24+
Visit the [releases page](https://github.com/origadmin/adptool/releases) to download pre-compiled binaries for your platform.
25+
2726
## Usage
2827

2928
### 1. Define Directives in Go Source
@@ -164,13 +163,13 @@ Execute `adptool` from your project root. It will find your directives and confi
164163
```sh
165164
# Generate code, scanning all .go files in the current directory.
166165
# Output will be in `adapter_generated.go` by default.
167-
adptool generate .
166+
adptool .
168167

169168
# Specify input files/directories and an output file.
170-
adptool generate -o ./my_adapters.go ./path/to/directives/
169+
adptool -o ./my_adapters.go ./path/to/directives/
171170

172171
# Use a specific config file instead of the default .adptool.yaml
173-
adptool generate -f ./configs/custom.yaml -o ./out.go .
172+
adptool -f ./configs/custom.yaml -o ./out.go .
174173
```
175174

176175
## Contributing

0 commit comments

Comments
 (0)