|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes how to publish a new version to NuGet. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. **Configure Trusted Publishing on NuGet.org** (one-time setup): |
| 8 | + - Go to: https://www.nuget.org/account/Packages |
| 9 | + - Find package: `XperienceCommunity.Sustainability` |
| 10 | + - Click "Manage" → "Trusted publishers" → "Add trusted publisher" |
| 11 | + - Fill in the form: |
| 12 | + - **Policy Name**: Any name (e.g., "GitHub Actions Auto-Publish") |
| 13 | + - **Package Owner**: `liamgold` (should be pre-selected) |
| 14 | + - **Repository Owner**: `liamgold` |
| 15 | + - **Repository**: `xperience-community-sustainability` |
| 16 | + - **Workflow File**: `publish.yml` |
| 17 | + - **Environment**: (leave blank) |
| 18 | + - Click "Create" |
| 19 | + |
| 20 | + This allows GitHub Actions to publish without API keys! |
| 21 | + |
| 22 | +## Publishing a New Version |
| 23 | + |
| 24 | +### 1. Update Version Number |
| 25 | +Edit `src/XperienceCommunity.Sustainability.csproj`: |
| 26 | +```xml |
| 27 | +<Version>2.1.0</Version> |
| 28 | +``` |
| 29 | + |
| 30 | +### 2. Commit and Push to Main |
| 31 | +```bash |
| 32 | +git add src/XperienceCommunity.Sustainability.csproj |
| 33 | +git commit -m "Bump version to 2.1.0" |
| 34 | +git push origin main |
| 35 | +``` |
| 36 | + |
| 37 | +### 3. Create GitHub Release (creates tag automatically) |
| 38 | +1. Go to: https://github.com/liamgold/xperience-community-sustainability/releases/new |
| 39 | +2. Choose tag: `v2.1.0` |
| 40 | +3. Release title: `v2.1.0` |
| 41 | +4. Add release notes describing changes |
| 42 | +5. Click "Publish release" |
| 43 | + |
| 44 | +### 5. Automatic Publishing |
| 45 | +The GitHub Action will automatically: |
| 46 | +- Build the project |
| 47 | +- Create the NuGet package |
| 48 | +- Publish to NuGet.org |
| 49 | + |
| 50 | +Monitor the workflow at: |
| 51 | +https://github.com/liamgold/xperience-community-sustainability/actions |
| 52 | + |
| 53 | +## Workflow Triggers |
| 54 | + |
| 55 | +- **CI (Build & Test)**: Runs on every push to main and on PRs |
| 56 | +- **Publish to NuGet**: Runs only when a GitHub Release is published |
| 57 | + |
| 58 | +## Version Strategy |
| 59 | + |
| 60 | +Follow [Semantic Versioning](https://semver.org/): |
| 61 | +- **Major** (3.0.0): Breaking changes |
| 62 | +- **Minor** (2.1.0): New features, backward compatible |
| 63 | +- **Patch** (2.0.1): Bug fixes, backward compatible |
| 64 | + |
| 65 | +## Troubleshooting |
| 66 | + |
| 67 | +### "Package already exists" error |
| 68 | +The workflow includes `--skip-duplicate` to handle this gracefully. |
| 69 | + |
| 70 | +### "Authentication failed" or "403 Forbidden" |
| 71 | +Make sure Trusted Publishing is configured correctly on NuGet.org (see Prerequisites above). |
| 72 | +Verify the owner, repository, and workflow name exactly match. |
| 73 | + |
| 74 | +### Want to publish manually? |
| 75 | +```bash |
| 76 | +dotnet pack src/XperienceCommunity.Sustainability.csproj --configuration Release |
| 77 | +dotnet nuget push src/bin/Release/*.nupkg --api-key YOUR_KEY --source https://api.nuget.org/v3/index.json |
| 78 | +``` |
0 commit comments