|
| 1 | +# SEFACA Build, Test, Deploy Workflow |
| 2 | + |
| 3 | +This minimal workflow enables repeatable deployment of SEFACA. |
| 4 | + |
| 5 | +## Quick Deploy (30 seconds) |
| 6 | + |
| 7 | +```bash |
| 8 | +# 1. Update Git SHA in both files |
| 9 | +SHA=$(git log -1 --format="%h") |
| 10 | +sed -i "s/Git SHA: .*/Git SHA: $SHA/" scripts/sefaca.sh scripts/install-standalone.sh |
| 11 | + |
| 12 | +# 2. Create gist |
| 13 | +gh gist create scripts/install-standalone.sh --desc "SEFACA v0.1.0 - Git SHA: $SHA" --public |
| 14 | + |
| 15 | +# 3. Test deployment |
| 16 | +curl -sSL https://gist.github.com/YOUR_GIST_ID/raw | sh |
| 17 | +source ~/.sefaca/bin/load-sefaca |
| 18 | +sefaca status |
| 19 | +``` |
| 20 | + |
| 21 | +## Components |
| 22 | + |
| 23 | +### 1. Core Script (`scripts/sefaca.sh`) |
| 24 | +- Main SEFACA functionality |
| 25 | +- Updated with Git SHA for tracking |
| 26 | +- Sourced by installer |
| 27 | + |
| 28 | +### 2. Installer (`scripts/install-standalone.sh`) |
| 29 | +- Self-contained shell archive |
| 30 | +- Embeds entire sefaca.sh |
| 31 | +- No external downloads |
| 32 | + |
| 33 | +### 3. Deployment |
| 34 | +- GitHub Gist for testing |
| 35 | +- Future: sefaca.dev CDN |
| 36 | + |
| 37 | +## Build Process |
| 38 | + |
| 39 | +1. **Update Version/SHA** |
| 40 | + ```bash |
| 41 | + # Get current SHA |
| 42 | + git log -1 --format="%h" |
| 43 | + |
| 44 | + # Update both files |
| 45 | + vim scripts/sefaca.sh # Update Git SHA comment |
| 46 | + vim scripts/install-standalone.sh # Update Git SHA and embedded content |
| 47 | + ``` |
| 48 | + |
| 49 | +2. **Test Locally** |
| 50 | + ```bash |
| 51 | + # Clean install test |
| 52 | + rm -rf ~/.sefaca/bin |
| 53 | + sh scripts/install-standalone.sh |
| 54 | + source ~/.sefaca/bin/load-sefaca |
| 55 | + sefaca run --context "[test:local:user@host(repo:branch)]" date |
| 56 | + sefaca logs |
| 57 | + ``` |
| 58 | + |
| 59 | +## Test Process |
| 60 | + |
| 61 | +1. **Local Testing** |
| 62 | + ```bash |
| 63 | + make test-local # Run test suite |
| 64 | + bash test-standalone.sh # Test installation |
| 65 | + ``` |
| 66 | + |
| 67 | +2. **Remote Testing** |
| 68 | + ```bash |
| 69 | + # On remote machine (e.g., pi.lan) |
| 70 | + curl -sSL https://gist.github.com/aygp-dr/1cc80b2e8156c599f357786b552e462d/raw | sh |
| 71 | + source ~/.sefaca/bin/load-sefaca |
| 72 | + sefaca status |
| 73 | + ``` |
| 74 | + |
| 75 | +## Deploy Process |
| 76 | + |
| 77 | +1. **Create Gist** |
| 78 | + ```bash |
| 79 | + gh gist create scripts/install-standalone.sh \ |
| 80 | + --desc "SEFACA Installer v0.1.0-minimal" \ |
| 81 | + --public |
| 82 | + ``` |
| 83 | + |
| 84 | +2. **Document Deployment** |
| 85 | + - Update DEPLOYMENT_EXPERIMENT.md with: |
| 86 | + - Gist ID |
| 87 | + - Git SHA |
| 88 | + - Test results |
| 89 | + - Any issues encountered |
| 90 | + |
| 91 | +3. **Validate** |
| 92 | + ```bash |
| 93 | + # Test the gist URL works |
| 94 | + curl -sSL https://gist.github.com/GIST_ID/raw | head -20 |
| 95 | + ``` |
| 96 | + |
| 97 | +## Current Deployments |
| 98 | + |
| 99 | +| Date | Gist ID | Git SHA | Status | |
| 100 | +|------|---------|---------|--------| |
| 101 | +| 2025-07-31 | 1cc80b2e8156c599f357786b552e462d | e384cfa | Active | |
| 102 | + |
| 103 | +## Rollback Process |
| 104 | + |
| 105 | +```bash |
| 106 | +# Use previous gist URL |
| 107 | +curl -sSL https://gist.github.com/PREVIOUS_GIST_ID/raw | sh |
| 108 | +``` |
| 109 | + |
| 110 | +## Best Practices |
| 111 | + |
| 112 | +1. **Always test locally first** |
| 113 | +2. **Update Git SHA for tracking** |
| 114 | +3. **Document each deployment** |
| 115 | +4. **Keep gists public for curl access** |
| 116 | +5. **Test from clean environment** |
| 117 | + |
| 118 | +## Troubleshooting |
| 119 | + |
| 120 | +### Common Issues |
| 121 | + |
| 122 | +1. **404 Errors**: Check gist URL format |
| 123 | +2. **Caching**: GitHub caches for ~5 minutes |
| 124 | +3. **Shell Compatibility**: Test on sh, bash, zsh |
| 125 | + |
| 126 | +### Debug Commands |
| 127 | + |
| 128 | +```bash |
| 129 | +# Verbose curl |
| 130 | +curl -vsSL https://gist.github.com/GIST_ID/raw |
| 131 | + |
| 132 | +# Check what was installed |
| 133 | +cat ~/.sefaca/bin/sefaca.sh | head -20 |
| 134 | + |
| 135 | +# Manual source test |
| 136 | +. ~/.sefaca/bin/sefaca.sh |
| 137 | +type sefaca |
| 138 | +``` |
0 commit comments