dotenvage 0.1.2

Dotenv with age encryption: encrypt/decrypt secrets in .env files
Documentation
# Automated Dependency Management - Summary

## ๐ŸŽฏ What You Asked For

> "Configure dependabot and/or our GHA workflows to have dependency
> updates done fully automatically, ideally batched up once per night
> or once per week, and then have them all merged into main, causing a
> patch version bump and a publish on crates.io, so that our latest
> version is always up to date."

## โœ… What I've Configured

### 1. **Grouped Weekly Dependency Updates**

- **Schedule:** Every Monday at 2:00 AM UTC
- **Behavior:** All patch and minor updates batched into a single PR
- **File:** `.github/dependabot.yml`

### 2. **Automatic PR Approval & Merge**

- **Patch/Minor Updates:** Automatically approved and merged after CI
  passes
- **Major Updates:** Flagged for manual review (NOT auto-merged)
- **File:** `.github/workflows/dependabot-auto-merge.yml`

### 3. **Automatic Version Bump & Publish**

- **Trigger:** When dependency updates are merged to main
- **Tool:** Uses Cocogitto (`cog bump --patch`)
- **Actions:**
  1. Bumps patch version in Cargo.toml
  2. Creates conventional commit automatically
  3. Creates git tag (e.g., v0.1.3)
  4. Generates GitHub Release
  5. Publishes to crates.io
- **File:** `.github/workflows/auto-version-bump.yml`

## ๐Ÿ“‹ What You Need to Do

### โœ… Already Completed:

1. **Auto-Merge** - Enabled via `gh repo edit --enable-auto-merge`
2. **GitHub Actions Permissions** - Configured with write permissions
   and PR approval
3. **crates.io Token** - Already configured as `CRATES_IO_TOKEN`

### ๐Ÿš€ Remaining Steps (2 minutes):

**Just commit and push** the new configuration files:

```bash
git add .github/
git commit -m "feat(ci): add automated dependency management"
git push
```

## ๐Ÿ”„ How It Works (The Full Cycle)

```text
Monday 2 AM UTC
       โ†“
Dependabot scans for updates
       โ†“
Creates grouped PR with all patch/minor updates
       โ†“
CI workflow runs (Format, Clippy, Tests)
       โ†“
Auto-merge workflow approves PR
       โ†“
PR merges automatically (after CI passes)
       โ†“
Version bump workflow triggers
       โ†“
Patch version bumped (e.g., 0.1.2 โ†’ 0.1.3)
       โ†“
Git tag created (v0.1.3)
       โ†“
GitHub Release created
       โ†“
Published to crates.io
       โ†“
โœ… Your crate is now up-to-date!
```

## ๐Ÿ“ Files Created/Modified

### Modified:

- `.github/dependabot.yml` - Enhanced with grouping, scheduling, and
  labels

### Created:

- `.github/workflows/dependabot-auto-merge.yml` - Auto-approval and
  merge logic
- `.github/workflows/auto-version-bump.yml` - Version bumping and
  publishing
- `.github/DEPENDABOT_AUTOMATION.md` - Detailed documentation
- `.github/SETUP_CHECKLIST.md` - Step-by-step setup guide
- `AUTOMATION_SUMMARY.md` (this file) - Overview and summary

## ๐Ÿ”’ Safety Features

- โœ… Only patch and minor updates auto-merge
- โœ… Major updates require manual review
- โœ… All updates must pass CI before merging
- โœ… Branch protection compatible (optional)
- โœ… Follows semantic versioning
- โœ… Conventional commit messages

## ๐ŸŽฏ Key Design Decisions

### โœ… Linear History (Rebase-Only)

- **Auto-merge uses `--rebase`** to maintain linear history
- No merge commits created by automation
- Clean, easy-to-follow git history
- Compatible with `git bisect` and history analysis

### โœ… Conventional Commits Throughout

- **Dependabot PRs:** Prefixed with `build(deps):` (configured in
  `dependabot.yml`)
- **Version bump commits:** Created by Cocogitto with `chore(bump):`
  prefix
- **All automation follows:** Conventional Commits standard
- Enables automatic changelog generation

### โœ… Cocogitto for Version Management

- Uses `cog bump --patch` instead of manual git tagging
- Automatically creates conventional commit for version bump
- Tags are created consistently
- Integrates with existing `cog.toml` configuration
- Future-proof for changelog automation

### โœ… Single Token Architecture

- Uses existing `CRATES_IO_TOKEN` (not a new token)
- Dependabot uses `GITHUB_TOKEN` (automatic, no setup needed)
- No separate token for Dependabot required
- Simple and secure token management

## ๐Ÿ“Š Expected Results

After setup, you'll see:

- **Weekly:** 1 Dependabot PR every Monday (grouped)
- **Automatic:** PR approved and merged (if CI passes)
- **Automatic:** Version bumped and published to crates.io
- **Result:** Always-updated dependencies without manual intervention

## ๐ŸŽ›๏ธ Customization Options

### Change Schedule (daily/weekly/monthly)

Edit `.github/dependabot.yml`:

```yaml
schedule:
  interval: "daily" # or "weekly" or "monthly"
```

### Change Day/Time

```yaml
schedule:
  interval: "weekly"
  day: "friday" # any day of the week
  time: "14:00" # 24-hour UTC time
```

### Disable Auto-Publish

Comment out the "Publish to crates.io" step in `auto-version-bump.yml`

### Separate Dependency Groups

Instead of grouping all updates, you can separate by type:

```yaml
groups:
  production-dependencies:
    dependency-type: "production"
  development-dependencies:
    dependency-type: "development"
```

## ๐Ÿงช Testing Before Going Live

### Test Dependabot Grouping

Wait for next Monday, or manually trigger by closing/reopening the
current Dependabot PR.

### Test Auto-Merge

Create a test PR and verify the workflow runs:

```bash
gh pr checks <PR-NUMBER>
```

### Test Version Bump (Dry Run)

You can manually test the version bump locally:

```bash
cargo install cargo-edit
cargo set-version --bump patch
git diff Cargo.toml
git checkout Cargo.toml  # undo changes
```

## ๐Ÿ“š Documentation

- **Detailed Guide:** `.github/DEPENDABOT_AUTOMATION.md`
- **Setup Steps:** `.github/SETUP_CHECKLIST.md`
- **This Summary:** `AUTOMATION_SUMMARY.md`

## ๐Ÿ†˜ Troubleshooting

See `.github/DEPENDABOT_AUTOMATION.md` for common issues and
solutions.

Quick checks:

```bash
# Verify configuration
cat .github/dependabot.yml

# Check recent workflow runs
gh run list --limit 10

# Check Dependabot PRs
gh pr list --label dependencies

# Verify secrets
gh secret list
```

## ๐ŸŽ“ Key Learnings from Research

Based on latest (2025/2026) best practices:

1. **Dependabot now supports grouped updates** (July 2025 feature)
2. **Cron expressions for scheduling** (April 2025 feature)
3. **Trusted Publishing for crates.io** (July 2025 feature -
   recommended but not required)
4. **pull_request_target** event is safer than pull_request for bot
   workflows
5. **cargo-edit** is the standard tool for version management

## ๐Ÿš€ Next Steps

1. โœ… Review the configuration files
2. โœ… Complete the setup checklist
3. โœ… Test with first Dependabot run
4. โœ… Monitor and adjust as needed
5. โœ… Apply to other repositories!

## โ“ Questions or Issues?

Refer to:

- `.github/DEPENDABOT_AUTOMATION.md` - Full documentation
- `.github/SETUP_CHECKLIST.md` - Setup instructions
- [GitHub Dependabot Docs]https://docs.github.com/code-security/dependabot
- [Automating Dependabot Guide]https://docs.github.com/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions

---

**Status:** โœ… Configuration Complete - Ready for Setup

**Next Action:** Follow `.github/SETUP_CHECKLIST.md` to enable
automation