ollama-client 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,376 @@
1
+ # Gem Release Guide
2
+
3
+ Complete guide for automated gem releases with MFA security via GitHub Actions.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Quick Start](#quick-start)
8
+ - [One-Time Setup](#one-time-setup)
9
+ - [Release Process](#release-process)
10
+ - [Troubleshooting](#troubleshooting)
11
+ - [How It Works](#how-it-works)
12
+
13
+ ---
14
+
15
+ ## Quick Start
16
+
17
+ **Already configured?** Just bump version and push a tag:
18
+
19
+ ```bash
20
+ # 1. Update version in lib/ollama/version.rb
21
+ VERSION = "0.2.4"
22
+
23
+ # 2. Commit and tag
24
+ git add lib/ollama/version.rb
25
+ git commit -m "Bump version to 0.2.4"
26
+ git tag v0.2.4
27
+ git push origin main
28
+ git push origin v0.2.4
29
+
30
+ # 3. Done! GitHub Actions will automatically release to RubyGems
31
+ ```
32
+
33
+ Check progress: https://github.com/shubhamtaywade82/ollama-client/actions
34
+
35
+ ---
36
+
37
+ ## One-Time Setup
38
+
39
+ ### Prerequisites
40
+
41
+ - RubyGems account at https://rubygems.org
42
+ - MFA enabled on RubyGems account
43
+ - Admin access to GitHub repository
44
+
45
+ ### Step 1: Get RubyGems API Key
46
+
47
+ 1. Log in to https://rubygems.org
48
+ 2. Go to **Edit Profile** → **API Keys** (or visit https://rubygems.org/profile/api_keys)
49
+ 3. Click **New API Key**
50
+ 4. Name: `GitHub Actions - ollama-client`
51
+ 5. Scopes: Select **Push rubygems**
52
+ 6. Click **Create**
53
+ 7. **Copy the API key** (you won't see it again!)
54
+
55
+ ### Step 2: Get RubyGems OTP Secret
56
+
57
+ This is needed because `rubygems_mfa_required = "true"` in the gemspec requires OTP verification.
58
+
59
+ #### What You Need
60
+
61
+ The **OTP secret key** (not the 6-digit codes), which looks like:
62
+ ```
63
+ JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP
64
+ ```
65
+
66
+ Valid characters: `A-Z` and `2-7` only (Base32 encoding)
67
+
68
+ #### How to Get It
69
+
70
+ **Option A: If you saved it when enabling MFA**
71
+ - Check your password manager, notes, or screenshots
72
+
73
+ **Option B: Regenerate MFA (if you can't find it)**
74
+
75
+ 1. Go to https://rubygems.org → **Edit Profile** → **Multi-factor Authentication**
76
+ 2. Click **"Disable Multi-factor Authentication"**
77
+ 3. Click **"Enable Multi-factor Authentication"** again
78
+ 4. **IMPORTANT: Copy the secret key text** (e.g., `JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP`)
79
+ 5. Scan the QR code with your authenticator app
80
+ 6. Enter the 6-digit code to verify
81
+ 7. **Update your authenticator app** (old codes won't work after regenerating)
82
+
83
+ #### Test Your Secret (Optional)
84
+
85
+ ```bash
86
+ gem install rotp
87
+ ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET_HERE').now"
88
+ ```
89
+
90
+ This should output a 6-digit number matching your authenticator app.
91
+
92
+ ### Step 3: Add Secrets to GitHub
93
+
94
+ 1. Go to: https://github.com/shubhamtaywade82/ollama-client/settings/secrets/actions
95
+ 2. Click **New repository secret**
96
+ 3. Add **first secret**:
97
+ - Name: `RUBYGEMS_API_KEY`
98
+ - Value: Your API key from Step 1
99
+ - Click **Add secret**
100
+ 4. Add **second secret**:
101
+ - Name: `RUBYGEMS_OTP_SECRET`
102
+ - Value: Your OTP secret from Step 2
103
+ - Click **Add secret**
104
+
105
+ ### Step 4: Verify Setup
106
+
107
+ Your repository should now have two secrets:
108
+ - ✅ `RUBYGEMS_API_KEY`
109
+ - ✅ `RUBYGEMS_OTP_SECRET`
110
+
111
+ **Setup complete!** 🎉
112
+
113
+ ---
114
+
115
+ ## Release Process
116
+
117
+ ### Standard Release
118
+
119
+ ```bash
120
+ # 1. Update version
121
+ vim lib/ollama/version.rb
122
+ # Change VERSION = "0.2.3" to VERSION = "0.2.4"
123
+
124
+ # 2. Update changelog (optional but recommended)
125
+ vim CHANGELOG.md
126
+
127
+ # 3. Commit changes
128
+ git add lib/ollama/version.rb CHANGELOG.md
129
+ git commit -m "Bump version to 0.2.4"
130
+
131
+ # 4. Create and push tag
132
+ git tag v0.2.4
133
+ git push origin main
134
+ git push origin v0.2.4
135
+
136
+ # 5. Monitor release
137
+ # Visit: https://github.com/shubhamtaywade82/ollama-client/actions
138
+ ```
139
+
140
+ ### What Happens Automatically
141
+
142
+ When you push a tag (e.g., `v0.2.4`), GitHub Actions will:
143
+
144
+ 1. ✅ **Validate** tag version matches `lib/ollama/version.rb`
145
+ 2. ✅ **Generate OTP code** automatically from your secret
146
+ 3. ✅ **Build gem** using `gem build ollama-client.gemspec`
147
+ 4. ✅ **Push to RubyGems** with OTP authentication
148
+ 5. ✅ **Publish successfully** - gem is live!
149
+
150
+ **No manual intervention needed!** ⚡
151
+
152
+ ### Checking Release Status
153
+
154
+ - **GitHub Actions:** https://github.com/shubhamtaywade82/ollama-client/actions
155
+ - **RubyGems:** https://rubygems.org/gems/ollama-client
156
+
157
+ ---
158
+
159
+ ## Troubleshooting
160
+
161
+ ### "Repushing of gem versions is not allowed"
162
+
163
+ **Problem:** You're trying to push a version that already exists on RubyGems.
164
+
165
+ **Solution:** Bump the version number in `lib/ollama/version.rb` to a new version.
166
+
167
+ ### "Invalid OTP code"
168
+
169
+ **Problem:** The OTP secret in GitHub Secrets is incorrect.
170
+
171
+ **Solutions:**
172
+ 1. Verify `RUBYGEMS_OTP_SECRET` matches your authenticator app's secret
173
+ 2. Test locally: `ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET').now"`
174
+ 3. If still failing, regenerate MFA on RubyGems and update the secret
175
+
176
+ ### "unauthorized" or "Access Denied"
177
+
178
+ **Problem:** API key is invalid or missing permissions.
179
+
180
+ **Solutions:**
181
+ 1. Verify `RUBYGEMS_API_KEY` is set in GitHub Secrets
182
+ 2. Check the API key has **"Push rubygems"** scope
183
+ 3. Generate a new API key on RubyGems and update the secret
184
+
185
+ ### "Tag version does not match gem version"
186
+
187
+ **Problem:** The git tag doesn't match the version in `lib/ollama/version.rb`.
188
+
189
+ **Solution:**
190
+ ```bash
191
+ # If tag is v0.2.4 but version.rb says 0.2.3:
192
+
193
+ # Option 1: Update version.rb and create new tag
194
+ vim lib/ollama/version.rb # Change to 0.2.4
195
+ git add lib/ollama/version.rb
196
+ git commit -m "Fix version"
197
+ git tag -d v0.2.4 # Delete local tag
198
+ git push origin :refs/tags/v0.2.4 # Delete remote tag
199
+ git tag v0.2.4 # Create new tag
200
+ git push origin main v0.2.4 # Push both
201
+
202
+ # Option 2: Create tag matching current version
203
+ # If version.rb says 0.2.3, use v0.2.3 tag instead
204
+ ```
205
+
206
+ ### "Invalid Base32 Character"
207
+
208
+ **Problem:** Your OTP secret contains invalid characters.
209
+
210
+ **Cause:** You're using the placeholder `'YOUR_SECRET_HERE'` or the 6-digit OTP code instead of the actual secret.
211
+
212
+ **Solution:** Get the real Base32 secret from RubyGems (see Step 2 in Setup).
213
+
214
+ Valid secret format:
215
+ - ✅ `JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP`
216
+ - ❌ `123456` (that's the OTP code, not the secret)
217
+ - ❌ `YOUR_SECRET_HERE` (that's the placeholder)
218
+
219
+ ### Workflow Not Running
220
+
221
+ **Problem:** You pushed a tag but GitHub Actions didn't trigger.
222
+
223
+ **Check:**
224
+ 1. Tag format is correct: `v1.2.3` (with `v` prefix)
225
+ 2. Workflow file exists: `.github/workflows/release.yml`
226
+ 3. Check Actions tab for errors: https://github.com/shubhamtaywade82/ollama-client/actions
227
+
228
+ ---
229
+
230
+ ## How It Works
231
+
232
+ ### GitHub Actions Workflow
233
+
234
+ The workflow (`.github/workflows/release.yml`) runs when you push a tag:
235
+
236
+ ```yaml
237
+ on:
238
+ push:
239
+ tags:
240
+ - "v*" # Triggers on any tag starting with 'v'
241
+ ```
242
+
243
+ ### Key Steps
244
+
245
+ 1. **Tag Validation**
246
+ ```bash
247
+ # Ensures tag matches gem version
248
+ tag_version="${GITHUB_REF#refs/tags/v}"
249
+ gem_version=$(ruby -e "require_relative 'lib/ollama/version'; puts Ollama::VERSION")
250
+ [ "$tag_version" = "$gem_version" ] || exit 1
251
+ ```
252
+
253
+ 2. **OTP Generation**
254
+ ```bash
255
+ # Automatically generates OTP code from secret
256
+ gem install rotp
257
+ otp_code=$(ruby -r rotp -e "puts ROTP::TOTP.new(ENV['RUBYGEMS_OTP_SECRET']).now")
258
+ ```
259
+
260
+ 3. **Gem Build**
261
+ ```bash
262
+ gem build ollama-client.gemspec
263
+ ```
264
+
265
+ 4. **Publish with OTP**
266
+ ```bash
267
+ gem push "ollama-client-${gem_version}.gem" --otp "$otp_code"
268
+ ```
269
+
270
+ ### Security Features
271
+
272
+ - 🔒 **MFA Required** - `rubygems_mfa_required = "true"` in gemspec
273
+ - 🔐 **Encrypted Secrets** - API key and OTP secret stored securely in GitHub
274
+ - ✅ **Tag Validation** - Prevents accidental version mismatches
275
+ - 🔍 **Audit Trail** - All releases logged in GitHub Actions
276
+
277
+ ### Why OTP is Needed
278
+
279
+ The gemspec has:
280
+ ```ruby
281
+ spec.metadata["rubygems_mfa_required"] = "true"
282
+ ```
283
+
284
+ This requires OTP verification for **all** gem pushes, including automated CI/CD. The workflow solves this by:
285
+ 1. Storing your OTP secret in GitHub Secrets
286
+ 2. Generating fresh OTP codes automatically on each release
287
+ 3. Passing the code to `gem push --otp`
288
+
289
+ **Result:** Fully automated releases with MFA security! 🚀
290
+
291
+ ---
292
+
293
+ ## Best Practices
294
+
295
+ ### Version Naming
296
+
297
+ Follow [Semantic Versioning](https://semver.org/):
298
+ - **Major** (X.0.0): Breaking changes
299
+ - **Minor** (0.X.0): New features, backward compatible
300
+ - **Patch** (0.0.X): Bug fixes, backward compatible
301
+
302
+ ### Changelog
303
+
304
+ Update `CHANGELOG.md` with each release:
305
+ ```markdown
306
+ ## [0.2.4] - 2026-01-18
307
+
308
+ ### Added
309
+ - New feature X
310
+
311
+ ### Fixed
312
+ - Bug fix Y
313
+
314
+ ### Changed
315
+ - Updated Z
316
+ ```
317
+
318
+ ### Git Tags
319
+
320
+ - Always use annotated tags: `git tag -a v1.2.3 -m "Release v1.2.3"`
321
+ - Include `v` prefix: `v1.2.3` not `1.2.3`
322
+ - Tag message should be descriptive
323
+
324
+ ### Security
325
+
326
+ - 🔄 **Rotate API keys** periodically
327
+ - 📝 **Review release logs** in GitHub Actions
328
+ - 🔒 **Keep secrets secure** - never commit them to git
329
+ - 🛡️ **Enable branch protection** on main branch
330
+
331
+ ---
332
+
333
+ ## Quick Reference
334
+
335
+ ### Commands Cheat Sheet
336
+
337
+ ```bash
338
+ # Check current version
339
+ ruby -e "require_relative 'lib/ollama/version'; puts Ollama::VERSION"
340
+
341
+ # Build gem locally
342
+ gem build ollama-client.gemspec
343
+
344
+ # Test OTP generation
345
+ ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET').now"
346
+
347
+ # List all tags
348
+ git tag -l
349
+
350
+ # Delete tag (if needed)
351
+ git tag -d v1.2.3 # Delete locally
352
+ git push origin :refs/tags/v1.2.3 # Delete remotely
353
+
354
+ # Create release
355
+ git tag v1.2.3 && git push origin v1.2.3
356
+ ```
357
+
358
+ ### Important Links
359
+
360
+ - **GitHub Actions:** https://github.com/shubhamtaywade82/ollama-client/actions
361
+ - **GitHub Secrets:** https://github.com/shubhamtaywade82/ollama-client/settings/secrets/actions
362
+ - **RubyGems Gem:** https://rubygems.org/gems/ollama-client
363
+ - **RubyGems API Keys:** https://rubygems.org/profile/api_keys
364
+ - **RubyGems MFA:** https://rubygems.org/profile/edit (Multi-factor Authentication section)
365
+
366
+ ---
367
+
368
+ ## Summary
369
+
370
+ ✅ **One-time setup:** Add two GitHub Secrets
371
+ ✅ **Every release:** Bump version + push tag
372
+ ✅ **Fully automated:** No manual gem push needed
373
+ ✅ **MFA secured:** OTP authentication on every release
374
+ ✅ **Production ready:** Used for all ollama-client releases
375
+
376
+ Questions or issues? Check the [Troubleshooting](#troubleshooting) section above.