DhanHQ 2.1.10 → 2.2.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +143 -118
- data/CHANGELOG.md +127 -0
- data/CODE_REVIEW_ISSUES.md +397 -0
- data/FIXES_APPLIED.md +373 -0
- data/GUIDE.md +41 -0
- data/README.md +55 -0
- data/RELEASING.md +60 -0
- data/REVIEW_SUMMARY.md +120 -0
- data/VERSION_UPDATE.md +82 -0
- data/core +0 -0
- data/docs/AUTHENTICATION.md +63 -0
- data/docs/DATA_API_PARAMETERS.md +278 -0
- data/docs/PR_2.2.0.md +48 -0
- data/docs/RELEASE_GUIDE.md +492 -0
- data/docs/TESTING_GUIDE.md +1514 -0
- data/docs/live_order_updates.md +25 -1
- data/docs/rails_integration.md +29 -0
- data/docs/websocket_integration.md +22 -0
- data/lib/DhanHQ/client.rb +65 -9
- data/lib/DhanHQ/configuration.rb +26 -0
- data/lib/DhanHQ/constants.rb +1 -1
- data/lib/DhanHQ/contracts/place_order_contract.rb +51 -0
- data/lib/DhanHQ/core/base_model.rb +17 -10
- data/lib/DhanHQ/errors.rb +4 -0
- data/lib/DhanHQ/helpers/request_helper.rb +17 -2
- data/lib/DhanHQ/helpers/response_helper.rb +34 -13
- data/lib/DhanHQ/models/expired_options_data.rb +0 -6
- data/lib/DhanHQ/models/instrument_helpers.rb +4 -4
- data/lib/DhanHQ/models/order.rb +19 -2
- data/lib/DhanHQ/models/order_update.rb +0 -4
- data/lib/DhanHQ/rate_limiter.rb +40 -6
- data/lib/DhanHQ/version.rb +1 -1
- data/lib/DhanHQ/ws/client.rb +11 -5
- data/lib/DhanHQ/ws/connection.rb +16 -2
- data/lib/DhanHQ/ws/market_depth/client.rb +2 -1
- data/lib/DhanHQ/ws/market_depth.rb +12 -12
- data/lib/DhanHQ/ws/orders/client.rb +76 -11
- data/lib/DhanHQ/ws/orders/connection.rb +2 -1
- metadata +18 -5
- data/lib/DhanHQ/contracts/modify_order_contract_copy.rb +0 -100
|
@@ -0,0 +1,492 @@
|
|
|
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/DhanHQ/version.rb
|
|
21
|
+
VERSION = "2.1.12"
|
|
22
|
+
|
|
23
|
+
# 2. Update CHANGELOG.md (recommended)
|
|
24
|
+
# Add release notes for the new version
|
|
25
|
+
|
|
26
|
+
# 3. Commit and tag
|
|
27
|
+
git add lib/DhanHQ/version.rb CHANGELOG.md
|
|
28
|
+
git commit -m "Bump version to 2.1.12"
|
|
29
|
+
git tag v2.1.12
|
|
30
|
+
git push origin main
|
|
31
|
+
git push origin v2.1.12
|
|
32
|
+
|
|
33
|
+
# 4. Done! GitHub Actions will automatically release to RubyGems
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Check progress: https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## One-Time Setup
|
|
41
|
+
|
|
42
|
+
### Prerequisites
|
|
43
|
+
|
|
44
|
+
- RubyGems account at https://rubygems.org
|
|
45
|
+
- MFA enabled on RubyGems account
|
|
46
|
+
- Admin access to GitHub repository
|
|
47
|
+
|
|
48
|
+
### Step 1: Get RubyGems API Key
|
|
49
|
+
|
|
50
|
+
1. Log in to https://rubygems.org
|
|
51
|
+
2. Go to **Edit Profile** → **API Keys** (or visit https://rubygems.org/profile/api_keys)
|
|
52
|
+
3. Click **New API Key**
|
|
53
|
+
4. Name: `GitHub Actions - DhanHQ`
|
|
54
|
+
5. Scopes: Select **Push rubygems**
|
|
55
|
+
6. Click **Create**
|
|
56
|
+
7. **Copy the API key** (you won't see it again!)
|
|
57
|
+
|
|
58
|
+
### Step 2: Get RubyGems OTP Secret
|
|
59
|
+
|
|
60
|
+
This is needed because `rubygems_mfa_required = "true"` in the gemspec requires OTP verification.
|
|
61
|
+
|
|
62
|
+
#### What You Need
|
|
63
|
+
|
|
64
|
+
The **OTP secret key** (not the 6-digit codes), which looks like:
|
|
65
|
+
```
|
|
66
|
+
JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Valid characters: `A-Z` and `2-7` only (Base32 encoding)
|
|
70
|
+
|
|
71
|
+
#### How to Get It
|
|
72
|
+
|
|
73
|
+
**Option A: If you saved it when enabling MFA**
|
|
74
|
+
- Check your password manager, notes, or screenshots
|
|
75
|
+
|
|
76
|
+
**Option B: Regenerate MFA (if you can't find it)**
|
|
77
|
+
|
|
78
|
+
1. Go to https://rubygems.org → **Edit Profile** → **Multi-factor Authentication**
|
|
79
|
+
2. Click **"Disable Multi-factor Authentication"**
|
|
80
|
+
3. Click **"Enable Multi-factor Authentication"** again
|
|
81
|
+
4. **IMPORTANT: Copy the secret key text** (e.g., `JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP`)
|
|
82
|
+
5. Scan the QR code with your authenticator app
|
|
83
|
+
6. Enter the 6-digit code to verify
|
|
84
|
+
7. **Update your authenticator app** (old codes won't work after regenerating)
|
|
85
|
+
|
|
86
|
+
#### Test Your Secret (Optional)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gem install rotp
|
|
90
|
+
ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET_HERE').now"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This should output a 6-digit number matching your authenticator app.
|
|
94
|
+
|
|
95
|
+
### Step 3: Add Secrets to GitHub
|
|
96
|
+
|
|
97
|
+
1. Go to: https://github.com/shubhamtaywade82/dhanhq-client/settings/secrets/actions
|
|
98
|
+
2. Click **New repository secret**
|
|
99
|
+
3. Add **first secret**:
|
|
100
|
+
- Name: `RUBYGEMS_API_KEY`
|
|
101
|
+
- Value: Your API key from Step 1
|
|
102
|
+
- Click **Add secret**
|
|
103
|
+
4. Add **second secret**:
|
|
104
|
+
- Name: `RUBYGEMS_OTP_SECRET`
|
|
105
|
+
- Value: Your OTP secret from Step 2
|
|
106
|
+
- Click **Add secret**
|
|
107
|
+
|
|
108
|
+
### Step 4: Verify Setup
|
|
109
|
+
|
|
110
|
+
Your repository should now have two secrets:
|
|
111
|
+
- ✅ `RUBYGEMS_API_KEY`
|
|
112
|
+
- ✅ `RUBYGEMS_OTP_SECRET`
|
|
113
|
+
|
|
114
|
+
**Setup complete!** 🎉
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Release Process
|
|
119
|
+
|
|
120
|
+
### Standard Release
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# 1. Update version
|
|
124
|
+
vim lib/DhanHQ/version.rb
|
|
125
|
+
# Change VERSION = "2.1.11" to VERSION = "2.1.12"
|
|
126
|
+
|
|
127
|
+
# 2. Update changelog (optional but recommended)
|
|
128
|
+
vim CHANGELOG.md
|
|
129
|
+
|
|
130
|
+
# 3. Commit changes
|
|
131
|
+
git add lib/DhanHQ/version.rb CHANGELOG.md
|
|
132
|
+
git commit -m "Bump version to 2.1.12"
|
|
133
|
+
|
|
134
|
+
# 4. Create and push tag
|
|
135
|
+
git tag v2.1.12
|
|
136
|
+
git push origin main
|
|
137
|
+
git push origin v2.1.12
|
|
138
|
+
|
|
139
|
+
# 5. Monitor release
|
|
140
|
+
# Visit: https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### What Happens Automatically
|
|
144
|
+
|
|
145
|
+
When you push a tag (e.g., `v2.1.12`), the **Release** workflow (`.github/workflows/release.yml`) runs:
|
|
146
|
+
|
|
147
|
+
1. ✅ **Validate** tag version matches `lib/DhanHQ/version.rb` (tag `v2.1.12` → gem version `2.1.12`)
|
|
148
|
+
2. ✅ **Generate OTP code** from secret `RUBYGEMS_OTP_SECRET`
|
|
149
|
+
3. ✅ **Build gem** using `gem build DhanHQ.gemspec`
|
|
150
|
+
4. ✅ **Push to RubyGems** with OTP using `GEM_HOST_API_KEY` (from secret `RUBYGEMS_API_KEY`)
|
|
151
|
+
|
|
152
|
+
Tests run on push/PR via the main CI workflow; the release job does not run tests. No GitHub Release is created (tag-only publish, same pattern as ollama-client).
|
|
153
|
+
|
|
154
|
+
**No manual intervention needed!** ⚡
|
|
155
|
+
|
|
156
|
+
### Checking Release Status
|
|
157
|
+
|
|
158
|
+
- **GitHub Actions:** https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
159
|
+
- **RubyGems:** https://rubygems.org/gems/DhanHQ
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Troubleshooting
|
|
164
|
+
|
|
165
|
+
### "Repushing of gem versions is not allowed"
|
|
166
|
+
|
|
167
|
+
**Problem:** You're trying to push a version that already exists on RubyGems.
|
|
168
|
+
|
|
169
|
+
**Solution:** Bump the version number in `lib/DhanHQ/version.rb` to a new version.
|
|
170
|
+
|
|
171
|
+
### "Invalid OTP code"
|
|
172
|
+
|
|
173
|
+
**Problem:** The OTP secret in GitHub Secrets is incorrect.
|
|
174
|
+
|
|
175
|
+
**Solutions:**
|
|
176
|
+
1. Verify `RUBYGEMS_OTP_SECRET` matches your authenticator app's secret
|
|
177
|
+
2. Test locally: `ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET').now"`
|
|
178
|
+
3. If still failing, regenerate MFA on RubyGems and update the secret
|
|
179
|
+
|
|
180
|
+
### "unauthorized" or "Access Denied"
|
|
181
|
+
|
|
182
|
+
**Problem:** API key is invalid or missing permissions.
|
|
183
|
+
|
|
184
|
+
**Solutions:**
|
|
185
|
+
1. Verify `RUBYGEMS_API_KEY` is set in GitHub Secrets
|
|
186
|
+
2. Check the API key has **"Push rubygems"** scope
|
|
187
|
+
3. Generate a new API key on RubyGems and update the secret
|
|
188
|
+
|
|
189
|
+
### "Tag version does not match gem version"
|
|
190
|
+
|
|
191
|
+
**Problem:** The git tag doesn't match the version in `lib/DhanHQ/version.rb`.
|
|
192
|
+
|
|
193
|
+
**Solution:**
|
|
194
|
+
```bash
|
|
195
|
+
# If tag is v2.1.12 but version.rb says 2.1.11:
|
|
196
|
+
|
|
197
|
+
# Option 1: Update version.rb and create new tag
|
|
198
|
+
vim lib/DhanHQ/version.rb # Change to 2.1.12
|
|
199
|
+
git add lib/DhanHQ/version.rb
|
|
200
|
+
git commit -m "Fix version"
|
|
201
|
+
git tag -d v2.1.12 # Delete local tag
|
|
202
|
+
git push origin :refs/tags/v2.1.12 # Delete remote tag
|
|
203
|
+
git tag v2.1.12 # Create new tag
|
|
204
|
+
git push origin main v2.1.12 # Push both
|
|
205
|
+
|
|
206
|
+
# Option 2: Create tag matching current version
|
|
207
|
+
# If version.rb says 2.1.11, use v2.1.11 tag instead
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### "Invalid Base32 Character"
|
|
211
|
+
|
|
212
|
+
**Problem:** Your OTP secret contains invalid characters.
|
|
213
|
+
|
|
214
|
+
**Cause:** You're using the placeholder `'YOUR_SECRET_HERE'` or the 6-digit OTP code instead of the actual secret.
|
|
215
|
+
|
|
216
|
+
**Solution:** Get the real Base32 secret from RubyGems (see Step 2 in Setup).
|
|
217
|
+
|
|
218
|
+
Valid secret format:
|
|
219
|
+
- ✅ `JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP`
|
|
220
|
+
- ❌ `123456` (that's the OTP code, not the secret)
|
|
221
|
+
- ❌ `YOUR_SECRET_HERE` (that's the placeholder)
|
|
222
|
+
|
|
223
|
+
### Workflow Not Running
|
|
224
|
+
|
|
225
|
+
**Problem:** You pushed a tag but GitHub Actions didn't trigger.
|
|
226
|
+
|
|
227
|
+
**Check:**
|
|
228
|
+
1. Tag format is correct: `v2.1.12` (with `v` prefix)
|
|
229
|
+
2. Workflow file exists: `.github/workflows/release.yml`
|
|
230
|
+
3. Check Actions tab for errors: https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
231
|
+
|
|
232
|
+
### Tests Failing
|
|
233
|
+
|
|
234
|
+
**Problem:** Tests fail during the release workflow.
|
|
235
|
+
|
|
236
|
+
**Solution:**
|
|
237
|
+
```bash
|
|
238
|
+
# Run tests locally before creating release
|
|
239
|
+
bundle exec rake
|
|
240
|
+
|
|
241
|
+
# Or run specific test suites
|
|
242
|
+
bundle exec rspec
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## How It Works
|
|
248
|
+
|
|
249
|
+
### GitHub Actions Workflow
|
|
250
|
+
|
|
251
|
+
The workflow (`.github/workflows/release.yml`) runs when you push a tag:
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
on:
|
|
255
|
+
push:
|
|
256
|
+
tags:
|
|
257
|
+
- "v*" # Triggers on any tag starting with 'v'
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Key Steps
|
|
261
|
+
|
|
262
|
+
1. **Tag Validation**
|
|
263
|
+
```bash
|
|
264
|
+
# Ensures tag (e.g. v2.1.12) matches gem version (2.1.12)
|
|
265
|
+
tag="${GITHUB_REF#refs/tags/}"
|
|
266
|
+
tag_version="${tag#v}"
|
|
267
|
+
gem_version=$(ruby -e "require_relative 'lib/DhanHQ/version'; puts DhanHQ::VERSION")
|
|
268
|
+
[ "$tag_version" = "$gem_version" ] || exit 1
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
2. **OTP Generation**
|
|
272
|
+
```bash
|
|
273
|
+
# Automatically generates OTP code from secret
|
|
274
|
+
gem install rotp
|
|
275
|
+
otp_code=$(ruby -r rotp -e "puts ROTP::TOTP.new(ENV['RUBYGEMS_OTP_SECRET']).now")
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
3. **Gem Build**
|
|
279
|
+
```bash
|
|
280
|
+
gem build DhanHQ.gemspec
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
4. **Publish with OTP**
|
|
284
|
+
```bash
|
|
285
|
+
# RubyGems uses GEM_HOST_API_KEY from the environment (set from secret RUBYGEMS_API_KEY)
|
|
286
|
+
gem push "DhanHQ-${gem_version}.gem" --otp "$otp_code"
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Security Features
|
|
290
|
+
|
|
291
|
+
- 🔒 **MFA Required** - `rubygems_mfa_required = "true"` in gemspec
|
|
292
|
+
- 🔐 **Encrypted Secrets** - API key and OTP secret stored securely in GitHub
|
|
293
|
+
- ✅ **Tag Validation** - Prevents accidental version mismatches
|
|
294
|
+
- 🔍 **Audit Trail** - All releases logged in GitHub Actions
|
|
295
|
+
- 🧪 **Test on main/PR** - Main CI workflow runs tests on push/PR; release runs only on tag
|
|
296
|
+
|
|
297
|
+
### Why OTP is Needed
|
|
298
|
+
|
|
299
|
+
The gemspec has:
|
|
300
|
+
```ruby
|
|
301
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
This requires OTP verification for **all** gem pushes, including automated CI/CD. The workflow solves this by:
|
|
305
|
+
1. Storing your OTP secret in GitHub Secrets
|
|
306
|
+
2. Generating fresh OTP codes automatically on each release
|
|
307
|
+
3. Passing the code to `gem push --otp`
|
|
308
|
+
|
|
309
|
+
**Result:** Fully automated releases with MFA security! 🚀
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Best Practices
|
|
314
|
+
|
|
315
|
+
### Version Naming
|
|
316
|
+
|
|
317
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
318
|
+
- **Major** (X.0.0): Breaking changes
|
|
319
|
+
- **Minor** (0.X.0): New features, backward compatible
|
|
320
|
+
- **Patch** (0.0.X): Bug fixes, backward compatible
|
|
321
|
+
|
|
322
|
+
Examples for DhanHQ:
|
|
323
|
+
- `2.2.0` - New major features (e.g., new WebSocket types)
|
|
324
|
+
- `2.1.12` - Bug fixes and minor improvements
|
|
325
|
+
- `3.0.0` - Breaking API changes
|
|
326
|
+
|
|
327
|
+
### Changelog
|
|
328
|
+
|
|
329
|
+
Update `CHANGELOG.md` with each release:
|
|
330
|
+
```markdown
|
|
331
|
+
## [2.1.12] - 2026-01-18
|
|
332
|
+
|
|
333
|
+
### Added
|
|
334
|
+
- New market feed API parameters documentation
|
|
335
|
+
- Expired options data API support
|
|
336
|
+
|
|
337
|
+
### Fixed
|
|
338
|
+
- Option chain filtering for zero last_price strikes
|
|
339
|
+
- WebSocket reconnection edge cases
|
|
340
|
+
|
|
341
|
+
### Changed
|
|
342
|
+
- Improved rate limiter for option chain APIs
|
|
343
|
+
- Updated README with better examples
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Pre-Release Checklist
|
|
347
|
+
|
|
348
|
+
Before creating a release:
|
|
349
|
+
|
|
350
|
+
- [ ] All tests passing: `bundle exec rake`
|
|
351
|
+
- [ ] Version updated in `lib/DhanHQ/version.rb`
|
|
352
|
+
- [ ] CHANGELOG.md updated with changes
|
|
353
|
+
- [ ] README.md updated if needed
|
|
354
|
+
- [ ] Documentation updated for new features
|
|
355
|
+
- [ ] Examples updated if API changed
|
|
356
|
+
- [ ] Breaking changes clearly documented
|
|
357
|
+
|
|
358
|
+
### Git Tags
|
|
359
|
+
|
|
360
|
+
- Always use annotated tags: `git tag -a v2.1.12 -m "Release v2.1.12"`
|
|
361
|
+
- Include `v` prefix: `v2.1.12` not `2.1.12`
|
|
362
|
+
- Tag message should be descriptive
|
|
363
|
+
- Tag from main/master branch only
|
|
364
|
+
|
|
365
|
+
### Security
|
|
366
|
+
|
|
367
|
+
- 🔄 **Rotate API keys** periodically (every 6-12 months)
|
|
368
|
+
- 📝 **Review release logs** in GitHub Actions
|
|
369
|
+
- 🔒 **Keep secrets secure** - never commit them to git
|
|
370
|
+
- 🛡️ **Enable branch protection** on main branch
|
|
371
|
+
- ⚠️ **Never disable MFA** on RubyGems account
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Quick Reference
|
|
376
|
+
|
|
377
|
+
### Commands Cheat Sheet
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Check current version
|
|
381
|
+
ruby -e "require_relative 'lib/DhanHQ/version'; puts DhanHQ::VERSION"
|
|
382
|
+
|
|
383
|
+
# Build gem locally
|
|
384
|
+
gem build DhanHQ.gemspec
|
|
385
|
+
|
|
386
|
+
# Install gem locally for testing
|
|
387
|
+
gem install ./DhanHQ-*.gem
|
|
388
|
+
|
|
389
|
+
# Test OTP generation
|
|
390
|
+
ruby -r rotp -e "puts ROTP::TOTP.new('YOUR_SECRET').now"
|
|
391
|
+
|
|
392
|
+
# Run tests
|
|
393
|
+
bundle exec rake
|
|
394
|
+
|
|
395
|
+
# List all tags
|
|
396
|
+
git tag -l
|
|
397
|
+
|
|
398
|
+
# Delete tag (if needed)
|
|
399
|
+
git tag -d v2.1.12 # Delete locally
|
|
400
|
+
git push origin :refs/tags/v2.1.12 # Delete remotely
|
|
401
|
+
|
|
402
|
+
# Create release (full process)
|
|
403
|
+
# 1. Update version
|
|
404
|
+
vim lib/DhanHQ/version.rb
|
|
405
|
+
# 2. Update changelog
|
|
406
|
+
vim CHANGELOG.md
|
|
407
|
+
# 3. Commit and tag
|
|
408
|
+
git add lib/DhanHQ/version.rb CHANGELOG.md
|
|
409
|
+
git commit -m "Release v2.1.12"
|
|
410
|
+
git tag v2.1.12
|
|
411
|
+
git push origin main v2.1.12
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Important Links
|
|
415
|
+
|
|
416
|
+
- **GitHub Actions:** https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
417
|
+
- **GitHub Secrets:** https://github.com/shubhamtaywade82/dhanhq-client/settings/secrets/actions
|
|
418
|
+
- **RubyGems Gem:** https://rubygems.org/gems/DhanHQ
|
|
419
|
+
- **RubyGems API Keys:** https://rubygems.org/profile/api_keys (use value as `RUBYGEMS_API_KEY`; workflow exposes it as `GEM_HOST_API_KEY`)
|
|
420
|
+
- **RubyGems MFA:** https://rubygems.org/profile/edit (Multi-factor Authentication section)
|
|
421
|
+
|
|
422
|
+
### Gem Information
|
|
423
|
+
|
|
424
|
+
- **Gem Name:** DhanHQ
|
|
425
|
+
- **Current Version:** Check `lib/DhanHQ/version.rb`
|
|
426
|
+
- **Required Ruby:** >= 3.1.0
|
|
427
|
+
- **License:** MIT
|
|
428
|
+
- **Homepage:** https://github.com/shubhamtaywade82/dhanhq-client
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Migration from Old Workflow
|
|
433
|
+
|
|
434
|
+
If you're migrating from the old `main.yml` workflow:
|
|
435
|
+
|
|
436
|
+
### Old Workflow Issues
|
|
437
|
+
|
|
438
|
+
The old workflow (`.github/workflows/main.yml`):
|
|
439
|
+
- ❌ Doesn't handle MFA/OTP
|
|
440
|
+
- ❌ Releases will fail due to MFA requirement
|
|
441
|
+
- ❌ No version validation
|
|
442
|
+
- ❌ No GitHub Release creation
|
|
443
|
+
|
|
444
|
+
### Migration Steps
|
|
445
|
+
|
|
446
|
+
1. **Add GitHub Secrets** (follow [One-Time Setup](#one-time-setup))
|
|
447
|
+
- `RUBYGEMS_API_KEY`
|
|
448
|
+
- `RUBYGEMS_OTP_SECRET`
|
|
449
|
+
|
|
450
|
+
2. **Use the new workflow**
|
|
451
|
+
- The new `.github/workflows/release.yml` is already created
|
|
452
|
+
- The old `main.yml` still runs tests on PRs and pushes
|
|
453
|
+
- The new `release.yml` only runs on tags
|
|
454
|
+
|
|
455
|
+
3. **Test the workflow**
|
|
456
|
+
```bash
|
|
457
|
+
# Update to next patch version
|
|
458
|
+
vim lib/DhanHQ/version.rb # e.g., 2.1.12
|
|
459
|
+
git add lib/DhanHQ/version.rb
|
|
460
|
+
git commit -m "Test release workflow"
|
|
461
|
+
git tag v2.1.12
|
|
462
|
+
git push origin main v2.1.12
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
4. **Monitor first release**
|
|
466
|
+
- Check GitHub Actions: https://github.com/shubhamtaywade82/dhanhq-client/actions
|
|
467
|
+
- Verify gem appears on RubyGems: https://rubygems.org/gems/DhanHQ
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Summary
|
|
472
|
+
|
|
473
|
+
✅ **One-time setup:** Add two GitHub Secrets
|
|
474
|
+
✅ **Every release:** Bump version + push tag
|
|
475
|
+
✅ **Fully automated:** No manual gem push needed
|
|
476
|
+
✅ **MFA secured:** OTP authentication on every release
|
|
477
|
+
✅ **Production ready:** Battle-tested release workflow
|
|
478
|
+
✅ **Tests integrated:** Ensures quality before release
|
|
479
|
+
✅ **Tag-only release:** Same pattern as ollama-client; push tag `v*` to publish
|
|
480
|
+
|
|
481
|
+
Questions or issues? Check the [Troubleshooting](#troubleshooting) section above.
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Release History
|
|
486
|
+
|
|
487
|
+
Track your releases at:
|
|
488
|
+
- **RubyGems:** https://rubygems.org/gems/DhanHQ/versions
|
|
489
|
+
|
|
490
|
+
### Recent Versions
|
|
491
|
+
|
|
492
|
+
Check `CHANGELOG.md` for detailed release history.
|