Skip to content

Commit 10d8da8

Browse files
m2declaude
andcommitted
Add CI/CD pipeline, Homebrew tap, and README updates
- Add CI workflow: fmt, clippy, test, and recipe JSON validation on push/PR - Add release workflow: cross-platform builds, GitHub Release, crates.io, npm publish, and Homebrew tap auto-update on version tags - Add Homebrew formula for m2de/homebrew-tap - Update README with docs link and Homebrew install option Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b519be0 commit 10d8da8

4 files changed

Lines changed: 267 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: dtolnay/rust-toolchain@stable
16+
with:
17+
components: rustfmt, clippy
18+
19+
- uses: Swatinem/rust-cache@v2
20+
21+
- name: Check formatting
22+
run: cargo fmt --check
23+
24+
- name: Lint
25+
run: cargo clippy -- -D warnings
26+
27+
- name: Run tests
28+
run: cargo test
29+
30+
validate-recipes:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Validate provider JSON files
36+
run: |
37+
exit_code=0
38+
for f in providers/*.json; do
39+
if ! python3 -m json.tool "$f" > /dev/null 2>&1; then
40+
echo "::error file=$f::Invalid JSON in $f"
41+
exit_code=1
42+
fi
43+
done
44+
exit $exit_code

.github/workflows/release.yml

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.target }})
14+
runs-on: ${{ matrix.runner }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- target: aarch64-apple-darwin
20+
runner: macos-14
21+
npm-pkg: getapi-cli-darwin-arm64
22+
cross: false
23+
- target: x86_64-apple-darwin
24+
runner: macos-13
25+
npm-pkg: getapi-cli-darwin-x64
26+
cross: false
27+
- target: x86_64-unknown-linux-gnu
28+
runner: ubuntu-latest
29+
npm-pkg: getapi-cli-linux-x64
30+
cross: false
31+
- target: aarch64-unknown-linux-gnu
32+
runner: ubuntu-latest
33+
npm-pkg: getapi-cli-linux-arm64
34+
cross: true
35+
- target: x86_64-pc-windows-msvc
36+
runner: windows-latest
37+
npm-pkg: getapi-cli-win32-x64
38+
cross: false
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- uses: dtolnay/rust-toolchain@stable
43+
if: ${{ !matrix.cross }}
44+
with:
45+
targets: ${{ matrix.target }}
46+
47+
- uses: Swatinem/rust-cache@v2
48+
with:
49+
key: ${{ matrix.target }}
50+
51+
- name: Install cross
52+
if: ${{ matrix.cross }}
53+
run: cargo install cross --git https://github.com/cross-rs/cross
54+
55+
- name: Build binary
56+
run: ${{ matrix.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target }}
57+
58+
- name: Prepare artifacts (Unix)
59+
if: runner.os != 'Windows'
60+
run: |
61+
BIN="target/${{ matrix.target }}/release/getapi"
62+
chmod +x "$BIN"
63+
64+
# Raw binary for npm
65+
mkdir -p npm-bin
66+
cp "$BIN" npm-bin/getapi
67+
68+
# Archive for GitHub Release
69+
ARCHIVE="getapi-${{ matrix.target }}.tar.gz"
70+
tar czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" getapi
71+
72+
- name: Prepare artifacts (Windows)
73+
if: runner.os == 'Windows'
74+
shell: pwsh
75+
run: |
76+
$BIN = "target/${{ matrix.target }}/release/getapi.exe"
77+
78+
# Raw binary for npm
79+
New-Item -ItemType Directory -Force -Path npm-bin
80+
Copy-Item $BIN npm-bin/getapi.exe
81+
82+
# Archive for GitHub Release
83+
Compress-Archive -Path $BIN -DestinationPath "getapi-${{ matrix.target }}.zip"
84+
85+
- name: Upload binary artifact (npm)
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: bin-${{ matrix.npm-pkg }}
89+
path: npm-bin/
90+
91+
- name: Upload release archive
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: archive-${{ matrix.target }}
95+
path: getapi-${{ matrix.target }}.*
96+
97+
github-release:
98+
needs: build
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/download-artifact@v4
102+
with:
103+
pattern: archive-*
104+
merge-multiple: true
105+
106+
- name: Create GitHub Release
107+
uses: softprops/action-gh-release@v2
108+
with:
109+
generate_release_notes: true
110+
files: |
111+
getapi-*.tar.gz
112+
getapi-*.zip
113+
114+
publish-crates:
115+
needs: build
116+
runs-on: ubuntu-latest
117+
steps:
118+
- uses: actions/checkout@v4
119+
120+
- uses: dtolnay/rust-toolchain@stable
121+
122+
- name: Publish to crates.io
123+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
124+
125+
publish-npm:
126+
needs: build
127+
runs-on: ubuntu-latest
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- uses: actions/setup-node@v4
132+
with:
133+
node-version: '20'
134+
registry-url: 'https://registry.npmjs.org'
135+
136+
- name: Download all binary artifacts
137+
uses: actions/download-artifact@v4
138+
with:
139+
pattern: bin-*
140+
path: artifacts
141+
142+
- name: Stage binaries into platform packages
143+
run: |
144+
PLATFORMS=(
145+
"getapi-cli-darwin-arm64"
146+
"getapi-cli-darwin-x64"
147+
"getapi-cli-linux-x64"
148+
"getapi-cli-linux-arm64"
149+
"getapi-cli-win32-x64"
150+
)
151+
152+
for pkg in "${PLATFORMS[@]}"; do
153+
mkdir -p "npm/${pkg}/bin"
154+
cp artifacts/bin-${pkg}/* "npm/${pkg}/bin/"
155+
156+
# chmod +x on Unix binaries
157+
if [[ "$pkg" != *"win32"* ]]; then
158+
chmod +x "npm/${pkg}/bin/getapi"
159+
fi
160+
done
161+
162+
- name: Publish platform packages
163+
env:
164+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
165+
run: |
166+
PLATFORMS=(
167+
"getapi-cli-darwin-arm64"
168+
"getapi-cli-darwin-x64"
169+
"getapi-cli-linux-x64"
170+
"getapi-cli-linux-arm64"
171+
"getapi-cli-win32-x64"
172+
)
173+
174+
for pkg in "${PLATFORMS[@]}"; do
175+
echo "Publishing ${pkg}..."
176+
cd "npm/${pkg}"
177+
npm publish --access public
178+
cd ../..
179+
done
180+
181+
- name: Publish shim package
182+
env:
183+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
184+
run: |
185+
cd npm/getapi-cli
186+
npm publish --access public
187+
188+
update-homebrew:
189+
needs: github-release
190+
runs-on: ubuntu-latest
191+
steps:
192+
- uses: mislav/bump-homebrew-formula-action@v3
193+
with:
194+
formula-name: getapi
195+
homebrew-tap: m2de/homebrew-tap
196+
download-url: https://github.com/m2de/getapi/archive/refs/tags/${{ github.ref_name }}.tar.gz
197+
env:
198+
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
**getapi** is a CLI that walks you through setting up API credentials for popular services. Instead of hunting through documentation, signup flows, and developer portals, getapi gives you step-by-step interactive guidance and writes the credentials to your project when you're done.
66

7+
**Documentation**: [m2de.github.io/getapi](https://m2de.github.io/getapi)
8+
79
## Quick Start
810

911
```sh
@@ -22,6 +24,12 @@ getapi list
2224

2325
## Install
2426

27+
### Homebrew
28+
29+
```sh
30+
brew install m2de/tap/getapi
31+
```
32+
2533
### Cargo (from source)
2634

2735
```sh

homebrew/getapi.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Getapi < Formula
2+
desc "Guided, interactive walkthroughs for setting up developer API credentials"
3+
homepage "https://github.com/m2de/getapi"
4+
url "https://github.com/m2de/getapi/archive/refs/tags/v0.1.0.tar.gz"
5+
sha256 "PLACEHOLDER"
6+
license "MIT"
7+
8+
depends_on "rust" => :build
9+
10+
def install
11+
system "cargo", "install", *std_cargo_args
12+
end
13+
14+
test do
15+
assert_match "getapi", shell_output("#{bin}/getapi --help")
16+
end
17+
end

0 commit comments

Comments
 (0)