botmaro-secrets-manager 0.2.0__tar.gz → 0.3.0__tar.gz

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.
Files changed (22) hide show
  1. {botmaro_secrets_manager-0.2.0/botmaro_secrets_manager.egg-info → botmaro_secrets_manager-0.3.0}/PKG-INFO +126 -21
  2. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/README.md +125 -20
  3. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0/botmaro_secrets_manager.egg-info}/PKG-INFO +126 -21
  4. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/botmaro_secrets_manager.egg-info/SOURCES.txt +2 -0
  5. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/pyproject.toml +1 -1
  6. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/cli.py +126 -0
  7. botmaro_secrets_manager-0.3.0/secrets_manager/formatters.py +317 -0
  8. botmaro_secrets_manager-0.3.0/tests/test_formatters.py +376 -0
  9. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/LICENSE +0 -0
  10. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/MANIFEST.in +0 -0
  11. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/botmaro_secrets_manager.egg-info/dependency_links.txt +0 -0
  12. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/botmaro_secrets_manager.egg-info/entry_points.txt +0 -0
  13. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/botmaro_secrets_manager.egg-info/requires.txt +0 -0
  14. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/botmaro_secrets_manager.egg-info/top_level.txt +0 -0
  15. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets.example.yml +0 -0
  16. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/__init__.py +0 -0
  17. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/config.py +0 -0
  18. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/core.py +0 -0
  19. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/gsm.py +0 -0
  20. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/secrets_manager/validator.py +0 -0
  21. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/setup.cfg +0 -0
  22. {botmaro_secrets_manager-0.2.0 → botmaro_secrets_manager-0.3.0}/tests/test_naming_convention.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: botmaro-secrets-manager
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A standalone secret management tool for multi-environment deployments with Google Secret Manager
5
5
  Author: Botmaro Team
6
6
  License: MIT
@@ -42,7 +42,10 @@ A standalone, environment-aware secret management tool built on Google Secret Ma
42
42
  - 🎯 **Project scoping** - Organize secrets by project within environments
43
43
  - 🔄 **Version control** - Leverage GSM's built-in versioning
44
44
  - 🚀 **CI/CD ready** - Bootstrap secrets in GitHub Actions or any CI/CD pipeline
45
+ - 📤 **Multiple export formats** - Export secrets in dotenv, JSON, YAML, GitHub Actions, and shell formats
46
+ - 🔗 **GitHub Actions integration** - Native composite action for seamless workflow integration
45
47
  - 🛠️ **CRUD operations** - Full create, read, update, delete support via CLI
48
+ - ✅ **Validation & checks** - Validate secrets before deployment, detect placeholders
46
49
  - 📦 **Pip installable** - Install as a standalone package
47
50
  - 🎨 **Rich CLI** - Beautiful, user-friendly command-line interface
48
51
  - 🔒 **IAM integration** - Automatic service account access management
@@ -265,6 +268,63 @@ secrets-manager delete staging.OLD_API_KEY
265
268
  secrets-manager delete staging.OLD_API_KEY --force
266
269
  ```
267
270
 
271
+ #### Export Command
272
+
273
+ Export secrets in various formats for CI/CD integration:
274
+
275
+ ```bash
276
+ secrets-manager export <environment> [OPTIONS]
277
+
278
+ Options:
279
+ --project, -p TEXT Project name to scope secrets
280
+ --config, -c TEXT Path to secrets config file
281
+ --format, -f TEXT Export format: dotenv, github-env, github-output, json, yaml, shell [default: dotenv]
282
+ --output, -o TEXT Output file (default: stdout)
283
+ --mask/--no-mask Mask secrets in logs (for GitHub Actions formats) [default: True]
284
+ --github-env Write directly to $GITHUB_ENV (GitHub Actions only)
285
+ --github-output Write directly to $GITHUB_OUTPUT (GitHub Actions only)
286
+ --verbose, -v Verbose output
287
+ ```
288
+
289
+ **Supported Formats:**
290
+ - `dotenv` / `env` - Standard .env file format (KEY=value)
291
+ - `github-env` - GitHub Actions environment file format with multiline support
292
+ - `github-output` - GitHub Actions job outputs format
293
+ - `json` - JSON object
294
+ - `yaml` / `yml` - YAML format
295
+ - `shell` / `sh` - Shell export script
296
+
297
+ **Examples:**
298
+
299
+ ```bash
300
+ # Export as .env file
301
+ secrets-manager export staging --format dotenv --output .env.staging
302
+
303
+ # Export as JSON
304
+ secrets-manager export prod --format json --output secrets.json
305
+
306
+ # Export to stdout (for piping)
307
+ secrets-manager export staging --format yaml
308
+
309
+ # Export with project scope
310
+ secrets-manager export staging --project myapp --format dotenv --output .env.myapp
311
+
312
+ # Export for GitHub Actions (in workflow)
313
+ secrets-manager export production --github-env
314
+
315
+ # Export as shell script
316
+ secrets-manager export staging --format shell --output load-secrets.sh
317
+ chmod +x load-secrets.sh
318
+ source load-secrets.sh
319
+ ```
320
+
321
+ **Use Cases:**
322
+ - Export secrets for local development (.env files)
323
+ - Generate configuration files in various formats
324
+ - Load secrets into GitHub Actions workflows
325
+ - Create shell scripts for environment setup
326
+ - Generate JSON/YAML for application configuration
327
+
268
328
  #### Grant Access Command
269
329
 
270
330
  Grant access to all secrets in an environment or project:
@@ -378,7 +438,56 @@ Validation Summary:
378
438
 
379
439
  ## GitHub Actions Integration
380
440
 
381
- ### Example Workflow
441
+ Botmaro Secrets Manager provides native GitHub Actions integration through a composite action that automatically loads secrets from GCP Secret Manager into your workflows.
442
+
443
+ ### Using the Composite Action (Recommended)
444
+
445
+ The easiest way to use secrets in GitHub Actions is with our composite action:
446
+
447
+ ```yaml
448
+ name: Deploy to Production
449
+
450
+ on:
451
+ push:
452
+ branches: [main]
453
+
454
+ permissions:
455
+ contents: read
456
+ id-token: write # Required for Workload Identity Federation
457
+
458
+ jobs:
459
+ deploy:
460
+ runs-on: ubuntu-latest
461
+ environment: production
462
+
463
+ steps:
464
+ - uses: actions/checkout@v4
465
+
466
+ - name: Load Secrets from GCP
467
+ uses: ./.github/actions/setup-secrets
468
+ with:
469
+ environment: production
470
+ gcp-project-id: my-gcp-project
471
+ workload-identity-provider: projects/123456789/locations/global/workloadIdentityPools/github/providers/github-provider
472
+ service-account: github-actions@my-gcp-project.iam.gserviceaccount.com
473
+
474
+ - name: Deploy Application
475
+ run: |
476
+ # All secrets are now available as environment variables
477
+ ./deploy.sh
478
+ ```
479
+
480
+ **Key Features:**
481
+ - ✅ Automatic authentication with Workload Identity Federation
482
+ - ✅ Built-in secrets validation
483
+ - ✅ Automatic secret masking in logs
484
+ - ✅ Zero secret duplication
485
+
486
+ 📖 **Full Documentation**: See [GITHUB_ACTIONS.md](GITHUB_ACTIONS.md) for complete setup instructions, including Workload Identity Federation configuration.
487
+
488
+ ### Manual CLI Integration
489
+
490
+ You can also use the CLI directly in your workflows:
382
491
 
383
492
  ```yaml
384
493
  name: Deploy
@@ -392,32 +501,29 @@ jobs:
392
501
  runs-on: ubuntu-latest
393
502
 
394
503
  steps:
395
- - uses: actions/checkout@v3
504
+ - uses: actions/checkout@v4
396
505
 
397
- - name: Set up Python
398
- uses: actions/setup-python@v4
506
+ - uses: actions/setup-python@v5
399
507
  with:
400
508
  python-version: '3.11'
401
509
 
402
- - name: Install secrets manager
403
- run: pip install -e .
510
+ - name: Install secrets-manager
511
+ run: pip install botmaro-gcp-secret-manager
404
512
 
405
- - name: Authenticate to Google Cloud
406
- uses: google-github-actions/auth@v1
513
+ - uses: google-github-actions/auth@v2
407
514
  with:
408
- credentials_json: ${{ secrets.GCP_SA_KEY }}
515
+ workload_identity_provider: projects/.../providers/github-provider
516
+ service_account: github-actions@project.iam.gserviceaccount.com
409
517
 
410
- - name: Bootstrap secrets
518
+ - name: Export secrets to GitHub environment
411
519
  run: |
412
- secrets-manager bootstrap staging \
413
- --runtime-sa botmaro-runner@project.iam.gserviceaccount.com \
414
- --config secrets.yml
520
+ secrets-manager export production --github-env
415
521
 
416
522
  - name: Deploy application
417
523
  run: |
418
- # Your deployment commands here
419
- # All secrets are now available as environment variables
420
- echo "Deploying with SUPABASE_URL=$SUPABASE_URL"
524
+ # Secrets are now available
525
+ echo "Deploying..."
526
+ ./deploy.sh
421
527
  ```
422
528
 
423
529
  ### Setting up initial secrets
@@ -431,12 +537,11 @@ Before running in GitHub Actions, you need to populate secrets using this tool's
431
537
  gcloud auth application-default login
432
538
 
433
539
  # 2. Use secrets-manager CLI to create and manage secrets
434
- secrets-manager set staging.SUPABASE_URL --value "https://xxx.supabase.co"
435
- secrets-manager set staging.SUPABASE_ANON_KEY --value "eyJxxx..."
436
- secrets-manager set staging.SUPABASE_SERVICE_ROLE_KEY --value "eyJxxx..."
540
+ secrets-manager set production.API_KEY --value "sk-123456"
541
+ secrets-manager set production.DATABASE_URL --value "postgres://..."
437
542
 
438
543
  # 3. Verify secrets were created
439
- secrets-manager list staging --reveal
544
+ secrets-manager list production --reveal
440
545
  ```
441
546
 
442
547
  The `secrets-manager` CLI automatically creates secrets in Google Secret Manager with proper naming conventions and IAM permissions.
@@ -8,7 +8,10 @@ A standalone, environment-aware secret management tool built on Google Secret Ma
8
8
  - 🎯 **Project scoping** - Organize secrets by project within environments
9
9
  - 🔄 **Version control** - Leverage GSM's built-in versioning
10
10
  - 🚀 **CI/CD ready** - Bootstrap secrets in GitHub Actions or any CI/CD pipeline
11
+ - 📤 **Multiple export formats** - Export secrets in dotenv, JSON, YAML, GitHub Actions, and shell formats
12
+ - 🔗 **GitHub Actions integration** - Native composite action for seamless workflow integration
11
13
  - 🛠️ **CRUD operations** - Full create, read, update, delete support via CLI
14
+ - ✅ **Validation & checks** - Validate secrets before deployment, detect placeholders
12
15
  - 📦 **Pip installable** - Install as a standalone package
13
16
  - 🎨 **Rich CLI** - Beautiful, user-friendly command-line interface
14
17
  - 🔒 **IAM integration** - Automatic service account access management
@@ -231,6 +234,63 @@ secrets-manager delete staging.OLD_API_KEY
231
234
  secrets-manager delete staging.OLD_API_KEY --force
232
235
  ```
233
236
 
237
+ #### Export Command
238
+
239
+ Export secrets in various formats for CI/CD integration:
240
+
241
+ ```bash
242
+ secrets-manager export <environment> [OPTIONS]
243
+
244
+ Options:
245
+ --project, -p TEXT Project name to scope secrets
246
+ --config, -c TEXT Path to secrets config file
247
+ --format, -f TEXT Export format: dotenv, github-env, github-output, json, yaml, shell [default: dotenv]
248
+ --output, -o TEXT Output file (default: stdout)
249
+ --mask/--no-mask Mask secrets in logs (for GitHub Actions formats) [default: True]
250
+ --github-env Write directly to $GITHUB_ENV (GitHub Actions only)
251
+ --github-output Write directly to $GITHUB_OUTPUT (GitHub Actions only)
252
+ --verbose, -v Verbose output
253
+ ```
254
+
255
+ **Supported Formats:**
256
+ - `dotenv` / `env` - Standard .env file format (KEY=value)
257
+ - `github-env` - GitHub Actions environment file format with multiline support
258
+ - `github-output` - GitHub Actions job outputs format
259
+ - `json` - JSON object
260
+ - `yaml` / `yml` - YAML format
261
+ - `shell` / `sh` - Shell export script
262
+
263
+ **Examples:**
264
+
265
+ ```bash
266
+ # Export as .env file
267
+ secrets-manager export staging --format dotenv --output .env.staging
268
+
269
+ # Export as JSON
270
+ secrets-manager export prod --format json --output secrets.json
271
+
272
+ # Export to stdout (for piping)
273
+ secrets-manager export staging --format yaml
274
+
275
+ # Export with project scope
276
+ secrets-manager export staging --project myapp --format dotenv --output .env.myapp
277
+
278
+ # Export for GitHub Actions (in workflow)
279
+ secrets-manager export production --github-env
280
+
281
+ # Export as shell script
282
+ secrets-manager export staging --format shell --output load-secrets.sh
283
+ chmod +x load-secrets.sh
284
+ source load-secrets.sh
285
+ ```
286
+
287
+ **Use Cases:**
288
+ - Export secrets for local development (.env files)
289
+ - Generate configuration files in various formats
290
+ - Load secrets into GitHub Actions workflows
291
+ - Create shell scripts for environment setup
292
+ - Generate JSON/YAML for application configuration
293
+
234
294
  #### Grant Access Command
235
295
 
236
296
  Grant access to all secrets in an environment or project:
@@ -344,7 +404,56 @@ Validation Summary:
344
404
 
345
405
  ## GitHub Actions Integration
346
406
 
347
- ### Example Workflow
407
+ Botmaro Secrets Manager provides native GitHub Actions integration through a composite action that automatically loads secrets from GCP Secret Manager into your workflows.
408
+
409
+ ### Using the Composite Action (Recommended)
410
+
411
+ The easiest way to use secrets in GitHub Actions is with our composite action:
412
+
413
+ ```yaml
414
+ name: Deploy to Production
415
+
416
+ on:
417
+ push:
418
+ branches: [main]
419
+
420
+ permissions:
421
+ contents: read
422
+ id-token: write # Required for Workload Identity Federation
423
+
424
+ jobs:
425
+ deploy:
426
+ runs-on: ubuntu-latest
427
+ environment: production
428
+
429
+ steps:
430
+ - uses: actions/checkout@v4
431
+
432
+ - name: Load Secrets from GCP
433
+ uses: ./.github/actions/setup-secrets
434
+ with:
435
+ environment: production
436
+ gcp-project-id: my-gcp-project
437
+ workload-identity-provider: projects/123456789/locations/global/workloadIdentityPools/github/providers/github-provider
438
+ service-account: github-actions@my-gcp-project.iam.gserviceaccount.com
439
+
440
+ - name: Deploy Application
441
+ run: |
442
+ # All secrets are now available as environment variables
443
+ ./deploy.sh
444
+ ```
445
+
446
+ **Key Features:**
447
+ - ✅ Automatic authentication with Workload Identity Federation
448
+ - ✅ Built-in secrets validation
449
+ - ✅ Automatic secret masking in logs
450
+ - ✅ Zero secret duplication
451
+
452
+ 📖 **Full Documentation**: See [GITHUB_ACTIONS.md](GITHUB_ACTIONS.md) for complete setup instructions, including Workload Identity Federation configuration.
453
+
454
+ ### Manual CLI Integration
455
+
456
+ You can also use the CLI directly in your workflows:
348
457
 
349
458
  ```yaml
350
459
  name: Deploy
@@ -358,32 +467,29 @@ jobs:
358
467
  runs-on: ubuntu-latest
359
468
 
360
469
  steps:
361
- - uses: actions/checkout@v3
470
+ - uses: actions/checkout@v4
362
471
 
363
- - name: Set up Python
364
- uses: actions/setup-python@v4
472
+ - uses: actions/setup-python@v5
365
473
  with:
366
474
  python-version: '3.11'
367
475
 
368
- - name: Install secrets manager
369
- run: pip install -e .
476
+ - name: Install secrets-manager
477
+ run: pip install botmaro-gcp-secret-manager
370
478
 
371
- - name: Authenticate to Google Cloud
372
- uses: google-github-actions/auth@v1
479
+ - uses: google-github-actions/auth@v2
373
480
  with:
374
- credentials_json: ${{ secrets.GCP_SA_KEY }}
481
+ workload_identity_provider: projects/.../providers/github-provider
482
+ service_account: github-actions@project.iam.gserviceaccount.com
375
483
 
376
- - name: Bootstrap secrets
484
+ - name: Export secrets to GitHub environment
377
485
  run: |
378
- secrets-manager bootstrap staging \
379
- --runtime-sa botmaro-runner@project.iam.gserviceaccount.com \
380
- --config secrets.yml
486
+ secrets-manager export production --github-env
381
487
 
382
488
  - name: Deploy application
383
489
  run: |
384
- # Your deployment commands here
385
- # All secrets are now available as environment variables
386
- echo "Deploying with SUPABASE_URL=$SUPABASE_URL"
490
+ # Secrets are now available
491
+ echo "Deploying..."
492
+ ./deploy.sh
387
493
  ```
388
494
 
389
495
  ### Setting up initial secrets
@@ -397,12 +503,11 @@ Before running in GitHub Actions, you need to populate secrets using this tool's
397
503
  gcloud auth application-default login
398
504
 
399
505
  # 2. Use secrets-manager CLI to create and manage secrets
400
- secrets-manager set staging.SUPABASE_URL --value "https://xxx.supabase.co"
401
- secrets-manager set staging.SUPABASE_ANON_KEY --value "eyJxxx..."
402
- secrets-manager set staging.SUPABASE_SERVICE_ROLE_KEY --value "eyJxxx..."
506
+ secrets-manager set production.API_KEY --value "sk-123456"
507
+ secrets-manager set production.DATABASE_URL --value "postgres://..."
403
508
 
404
509
  # 3. Verify secrets were created
405
- secrets-manager list staging --reveal
510
+ secrets-manager list production --reveal
406
511
  ```
407
512
 
408
513
  The `secrets-manager` CLI automatically creates secrets in Google Secret Manager with proper naming conventions and IAM permissions.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: botmaro-secrets-manager
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A standalone secret management tool for multi-environment deployments with Google Secret Manager
5
5
  Author: Botmaro Team
6
6
  License: MIT
@@ -42,7 +42,10 @@ A standalone, environment-aware secret management tool built on Google Secret Ma
42
42
  - 🎯 **Project scoping** - Organize secrets by project within environments
43
43
  - 🔄 **Version control** - Leverage GSM's built-in versioning
44
44
  - 🚀 **CI/CD ready** - Bootstrap secrets in GitHub Actions or any CI/CD pipeline
45
+ - 📤 **Multiple export formats** - Export secrets in dotenv, JSON, YAML, GitHub Actions, and shell formats
46
+ - 🔗 **GitHub Actions integration** - Native composite action for seamless workflow integration
45
47
  - 🛠️ **CRUD operations** - Full create, read, update, delete support via CLI
48
+ - ✅ **Validation & checks** - Validate secrets before deployment, detect placeholders
46
49
  - 📦 **Pip installable** - Install as a standalone package
47
50
  - 🎨 **Rich CLI** - Beautiful, user-friendly command-line interface
48
51
  - 🔒 **IAM integration** - Automatic service account access management
@@ -265,6 +268,63 @@ secrets-manager delete staging.OLD_API_KEY
265
268
  secrets-manager delete staging.OLD_API_KEY --force
266
269
  ```
267
270
 
271
+ #### Export Command
272
+
273
+ Export secrets in various formats for CI/CD integration:
274
+
275
+ ```bash
276
+ secrets-manager export <environment> [OPTIONS]
277
+
278
+ Options:
279
+ --project, -p TEXT Project name to scope secrets
280
+ --config, -c TEXT Path to secrets config file
281
+ --format, -f TEXT Export format: dotenv, github-env, github-output, json, yaml, shell [default: dotenv]
282
+ --output, -o TEXT Output file (default: stdout)
283
+ --mask/--no-mask Mask secrets in logs (for GitHub Actions formats) [default: True]
284
+ --github-env Write directly to $GITHUB_ENV (GitHub Actions only)
285
+ --github-output Write directly to $GITHUB_OUTPUT (GitHub Actions only)
286
+ --verbose, -v Verbose output
287
+ ```
288
+
289
+ **Supported Formats:**
290
+ - `dotenv` / `env` - Standard .env file format (KEY=value)
291
+ - `github-env` - GitHub Actions environment file format with multiline support
292
+ - `github-output` - GitHub Actions job outputs format
293
+ - `json` - JSON object
294
+ - `yaml` / `yml` - YAML format
295
+ - `shell` / `sh` - Shell export script
296
+
297
+ **Examples:**
298
+
299
+ ```bash
300
+ # Export as .env file
301
+ secrets-manager export staging --format dotenv --output .env.staging
302
+
303
+ # Export as JSON
304
+ secrets-manager export prod --format json --output secrets.json
305
+
306
+ # Export to stdout (for piping)
307
+ secrets-manager export staging --format yaml
308
+
309
+ # Export with project scope
310
+ secrets-manager export staging --project myapp --format dotenv --output .env.myapp
311
+
312
+ # Export for GitHub Actions (in workflow)
313
+ secrets-manager export production --github-env
314
+
315
+ # Export as shell script
316
+ secrets-manager export staging --format shell --output load-secrets.sh
317
+ chmod +x load-secrets.sh
318
+ source load-secrets.sh
319
+ ```
320
+
321
+ **Use Cases:**
322
+ - Export secrets for local development (.env files)
323
+ - Generate configuration files in various formats
324
+ - Load secrets into GitHub Actions workflows
325
+ - Create shell scripts for environment setup
326
+ - Generate JSON/YAML for application configuration
327
+
268
328
  #### Grant Access Command
269
329
 
270
330
  Grant access to all secrets in an environment or project:
@@ -378,7 +438,56 @@ Validation Summary:
378
438
 
379
439
  ## GitHub Actions Integration
380
440
 
381
- ### Example Workflow
441
+ Botmaro Secrets Manager provides native GitHub Actions integration through a composite action that automatically loads secrets from GCP Secret Manager into your workflows.
442
+
443
+ ### Using the Composite Action (Recommended)
444
+
445
+ The easiest way to use secrets in GitHub Actions is with our composite action:
446
+
447
+ ```yaml
448
+ name: Deploy to Production
449
+
450
+ on:
451
+ push:
452
+ branches: [main]
453
+
454
+ permissions:
455
+ contents: read
456
+ id-token: write # Required for Workload Identity Federation
457
+
458
+ jobs:
459
+ deploy:
460
+ runs-on: ubuntu-latest
461
+ environment: production
462
+
463
+ steps:
464
+ - uses: actions/checkout@v4
465
+
466
+ - name: Load Secrets from GCP
467
+ uses: ./.github/actions/setup-secrets
468
+ with:
469
+ environment: production
470
+ gcp-project-id: my-gcp-project
471
+ workload-identity-provider: projects/123456789/locations/global/workloadIdentityPools/github/providers/github-provider
472
+ service-account: github-actions@my-gcp-project.iam.gserviceaccount.com
473
+
474
+ - name: Deploy Application
475
+ run: |
476
+ # All secrets are now available as environment variables
477
+ ./deploy.sh
478
+ ```
479
+
480
+ **Key Features:**
481
+ - ✅ Automatic authentication with Workload Identity Federation
482
+ - ✅ Built-in secrets validation
483
+ - ✅ Automatic secret masking in logs
484
+ - ✅ Zero secret duplication
485
+
486
+ 📖 **Full Documentation**: See [GITHUB_ACTIONS.md](GITHUB_ACTIONS.md) for complete setup instructions, including Workload Identity Federation configuration.
487
+
488
+ ### Manual CLI Integration
489
+
490
+ You can also use the CLI directly in your workflows:
382
491
 
383
492
  ```yaml
384
493
  name: Deploy
@@ -392,32 +501,29 @@ jobs:
392
501
  runs-on: ubuntu-latest
393
502
 
394
503
  steps:
395
- - uses: actions/checkout@v3
504
+ - uses: actions/checkout@v4
396
505
 
397
- - name: Set up Python
398
- uses: actions/setup-python@v4
506
+ - uses: actions/setup-python@v5
399
507
  with:
400
508
  python-version: '3.11'
401
509
 
402
- - name: Install secrets manager
403
- run: pip install -e .
510
+ - name: Install secrets-manager
511
+ run: pip install botmaro-gcp-secret-manager
404
512
 
405
- - name: Authenticate to Google Cloud
406
- uses: google-github-actions/auth@v1
513
+ - uses: google-github-actions/auth@v2
407
514
  with:
408
- credentials_json: ${{ secrets.GCP_SA_KEY }}
515
+ workload_identity_provider: projects/.../providers/github-provider
516
+ service_account: github-actions@project.iam.gserviceaccount.com
409
517
 
410
- - name: Bootstrap secrets
518
+ - name: Export secrets to GitHub environment
411
519
  run: |
412
- secrets-manager bootstrap staging \
413
- --runtime-sa botmaro-runner@project.iam.gserviceaccount.com \
414
- --config secrets.yml
520
+ secrets-manager export production --github-env
415
521
 
416
522
  - name: Deploy application
417
523
  run: |
418
- # Your deployment commands here
419
- # All secrets are now available as environment variables
420
- echo "Deploying with SUPABASE_URL=$SUPABASE_URL"
524
+ # Secrets are now available
525
+ echo "Deploying..."
526
+ ./deploy.sh
421
527
  ```
422
528
 
423
529
  ### Setting up initial secrets
@@ -431,12 +537,11 @@ Before running in GitHub Actions, you need to populate secrets using this tool's
431
537
  gcloud auth application-default login
432
538
 
433
539
  # 2. Use secrets-manager CLI to create and manage secrets
434
- secrets-manager set staging.SUPABASE_URL --value "https://xxx.supabase.co"
435
- secrets-manager set staging.SUPABASE_ANON_KEY --value "eyJxxx..."
436
- secrets-manager set staging.SUPABASE_SERVICE_ROLE_KEY --value "eyJxxx..."
540
+ secrets-manager set production.API_KEY --value "sk-123456"
541
+ secrets-manager set production.DATABASE_URL --value "postgres://..."
437
542
 
438
543
  # 3. Verify secrets were created
439
- secrets-manager list staging --reveal
544
+ secrets-manager list production --reveal
440
545
  ```
441
546
 
442
547
  The `secrets-manager` CLI automatically creates secrets in Google Secret Manager with proper naming conventions and IAM permissions.
@@ -13,6 +13,8 @@ secrets_manager/__init__.py
13
13
  secrets_manager/cli.py
14
14
  secrets_manager/config.py
15
15
  secrets_manager/core.py
16
+ secrets_manager/formatters.py
16
17
  secrets_manager/gsm.py
17
18
  secrets_manager/validator.py
19
+ tests/test_formatters.py
18
20
  tests/test_naming_convention.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "botmaro-secrets-manager"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "A standalone secret management tool for multi-environment deployments with Google Secret Manager"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"