|
| 1 | +# Releasing a New Sourcegraph Documentation Version |
| 2 | + |
| 3 | +This guide explains the complete process for releasing documentation for a new Sourcegraph version, including deploying to the legacy versions repository and updating the main branch for the next version. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +- **Origin**: `sourcegraph/docs` - Main documentation repository with full commit history |
| 8 | +- **Legacy**: `sourcegraph/docs-legacy-versions` - Version-specific branches with squashed commits per version |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +1. **Add legacy remote** (one-time setup): |
| 13 | + ```bash |
| 14 | + git remote add legacy git@github.com:sourcegraph/docs-legacy-versions.git |
| 15 | + ``` |
| 16 | + |
| 17 | +2. **Verify remotes**: |
| 18 | + ```bash |
| 19 | + git remote -v |
| 20 | + # Should show both origin and legacy |
| 21 | + ``` |
| 22 | + |
| 23 | +## Part 1: Deploy Legacy Version |
| 24 | + |
| 25 | +1. **Ensure you're on main with latest changes**: |
| 26 | + ```bash |
| 27 | + git checkout main |
| 28 | + git pull origin main |
| 29 | + ``` |
| 30 | + |
| 31 | +2. **Find the commit SHA for your version cutoff**: |
| 32 | + ```bash |
| 33 | + git log --oneline |
| 34 | + # Identify the last commit that should be included in this version |
| 35 | + ``` |
| 36 | + |
| 37 | +3. **Create version branch from that SHA**: |
| 38 | + ```bash |
| 39 | + git checkout <SHA> |
| 40 | + git switch -c v<VERSION> # e.g., git switch -c v6-8 |
| 41 | + ``` |
| 42 | + |
| 43 | +4. **Comment out basePath in next.config.js**: |
| 44 | + ```javascript |
| 45 | + // basePath: process.env.VERCEL_ENV === 'production' ? '/docs' : '', |
| 46 | + ``` |
| 47 | + |
| 48 | +5. **Squash all commits since last version** (if needed): |
| 49 | + ```bash |
| 50 | + git fetch legacy |
| 51 | + git reset --soft legacy/v<PREVIOUS_VERSION> # e.g., legacy/v6-7 |
| 52 | + git commit -m "Docs for Sourcegraph version <VERSION>" |
| 53 | + ``` |
| 54 | + |
| 55 | +6. **Push to legacy repository**: |
| 56 | + ```bash |
| 57 | + git push legacy v<VERSION> |
| 58 | + ``` |
| 59 | + |
| 60 | +7. **Create PR to add domain to infrastructure**: |
| 61 | + - Create a PR to https://github.com/sourcegraph/infrastructure/blob/main/dns/sourcegraph.vercel.tf |
| 62 | + - This adds the domain name to Cloudflare so it can be added in Vercel |
| 63 | + |
| 64 | +8. **Create Vercel domain for the new version**: |
| 65 | + - Go to https://vercel.com/sourcegraph-f8c71130/docs-legacy-versions/settings/domains |
| 66 | + - Click "Add Domain" |
| 67 | + - Select "Connect to an environment" |
| 68 | + - Select "Preview" from dropdown |
| 69 | + - Select your branch name (e.g., `v6-8`) |
| 70 | + - Hit "Save" |
| 71 | + |
| 72 | +## Part 2: Update Main Branch for Next Version |
| 73 | + |
| 74 | +After successfully deploying the legacy version, update the main branch to point to the next version: |
| 75 | + |
| 76 | +1. **Return to main branch**: |
| 77 | + ```bash |
| 78 | + git checkout main |
| 79 | + git pull origin main |
| 80 | + ``` |
| 81 | + |
| 82 | +2. **Update version configuration files**: |
| 83 | + |
| 84 | + **In `docs.config.js`**: |
| 85 | + ```javascript |
| 86 | + DOCS_LATEST_VERSION: '6.9', // Update to next version |
| 87 | + ``` |
| 88 | + |
| 89 | + **In `src/data/versions.ts`** (update the latest version and add the new legacy version): |
| 90 | + ```typescript |
| 91 | + // Update the latest version reference |
| 92 | + // Add the newly created legacy version to the versions array |
| 93 | + ``` |
| 94 | + |
| 95 | + **In `docs/legacy.mdx`** (add the newly released version to the top of the appropriate section): |
| 96 | + ```markdown |
| 97 | + <Accordion title="Sourcegraph 6.X"> |
| 98 | + - [6.8](https://6.8.sourcegraph.com) // Add the new version here |
| 99 | + - [6.7](https://6.7.sourcegraph.com) |
| 100 | + // ... existing versions |
| 101 | + ``` |
| 102 | + |
| 103 | +3. **Commit and create PR for the version update**: |
| 104 | + ```bash |
| 105 | + git checkout -b update-docs-to-6.9 |
| 106 | + git add docs.config.js src/data/versions.ts docs/legacy.mdx |
| 107 | + git commit -m "Update docs to version 6.9" |
| 108 | + git push origin update-docs-to-6.9 |
| 109 | + # Then create a PR on GitHub to merge this branch into main |
| 110 | + ``` |
| 111 | + |
| 112 | +## Complete Example: Releasing v6.8 |
| 113 | + |
| 114 | +```bash |
| 115 | +# PART 1: Deploy Legacy Version |
| 116 | +# =============================== |
| 117 | + |
| 118 | +# 1. Setup (if not done already) |
| 119 | +git remote add legacy git@github.com:sourcegraph/docs-legacy-versions.git |
| 120 | + |
| 121 | +# 2. Create version branch |
| 122 | +git checkout cb15edb6 # or your chosen SHA |
| 123 | +git switch -c v6-8 |
| 124 | + |
| 125 | +# 3. Comment out basePath in next.config.js |
| 126 | +# (edit the file manually) |
| 127 | + |
| 128 | +# 4. Squash commits if you have many |
| 129 | +git fetch legacy |
| 130 | +git reset --soft legacy/v6-7 |
| 131 | +git commit -m "Docs for Sourcegraph version 6.8" |
| 132 | + |
| 133 | +# 5. Push to legacy |
| 134 | +git push legacy v6-8 |
| 135 | + |
| 136 | +# 6. Create PR to add domain to infrastructure |
| 137 | +# Create a PR to https://github.com/sourcegraph/infrastructure/blob/main/dns/sourcegraph.vercel.tf |
| 138 | + |
| 139 | +# 7. Create Vercel domain |
| 140 | +# Go to https://vercel.com/sourcegraph-f8c71130/docs-legacy-versions/settings/domains |
| 141 | +# Add domain -> Connect to environment -> Preview -> v6-8 -> Save |
| 142 | + |
| 143 | +# PART 2: Update Main to v6.9 |
| 144 | +# ============================ |
| 145 | + |
| 146 | +# 8. Return to main and update for next version |
| 147 | +git checkout main |
| 148 | +git pull origin main |
| 149 | + |
| 150 | +# 9. Create a new branch for the version update |
| 151 | +git checkout -b update-docs-to-6.9 |
| 152 | + |
| 153 | +# 10. Edit docs.config.js to update DOCS_LATEST_VERSION: '6.9' |
| 154 | +# 11. Edit src/data/versions.ts to add v6.8 to legacy versions and update latest |
| 155 | +# 12. Edit docs/legacy.mdx to add 6.8 link to the Sourcegraph 6.X section |
| 156 | + |
| 157 | +# 13. Commit and push to create PR |
| 158 | +git add docs.config.js src/data/versions.ts docs/legacy.mdx |
| 159 | +git commit -m "Update docs to version 6.9" |
| 160 | +git push origin update-docs-to-6.9 |
| 161 | +# Then create a PR on GitHub to merge this branch into main |
| 162 | +``` |
| 163 | + |
| 164 | +## Notes |
| 165 | + |
| 166 | +- Each legacy branch should have minimal commits (typically 1-2 per version) |
| 167 | +- The basePath must be commented out for legacy deployments to work properly |
| 168 | +- If push fails due to network issues, retry the `git push legacy v<VERSION>` command |
| 169 | +- Legacy branches are deployed to version-specific subdomains (e.g., `6-6.sourcegraph.com`) |
| 170 | + |
| 171 | + |
| 172 | +## Reference Links |
| 173 | + |
| 174 | +- Example of version update changes: https://github.com/sourcegraph/docs/pull/1336/files |
| 175 | +- Infrastructure DNS configuration: https://github.com/sourcegraph/infrastructure/blob/main/dns/sourcegraph.vercel.tf |
| 176 | +- Vercel domains dashboard: https://vercel.com/sourcegraph-f8c71130/docs-legacy-versions/settings/domains |
0 commit comments