Skip to content

Commit 19f00a5

Browse files
authored
Merge branch 'master' into claude/fix-issue-416-gans-info-011CUuXh3W5VhNfJKeXcCBPm
2 parents 7243ca8 + 4fc914a commit 19f00a5

1,989 files changed

Lines changed: 391990 additions & 183143 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/AUTOMATED_RELEASE_SETUP.md

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
# Automated Release Pipeline - Installation Instructions
2+
3+
## Overview
4+
5+
This directory contains an automated release pipeline template that provides:
6+
7+
- **Automated Semantic Versioning** from conventional commits
8+
- **Changelog Generation** with categorized changes
9+
- **GitHub Releases** with NuGet package artifacts
10+
- **NuGet Publishing** to nuget.org
11+
- **100% Automated** - no manual version bumps needed
12+
13+
## Why a Template?
14+
15+
GitHub security policies prevent automated tools from directly modifying workflow files in `.github/workflows/`. This template must be manually installed by a repository maintainer with appropriate permissions.
16+
17+
## Installation
18+
19+
### Step 1: Copy the Workflow File
20+
21+
```bash
22+
# From the repository root
23+
cp .github/AUTOMATED_RELEASE_WORKFLOW.yml .github/workflows/release.yml
24+
```
25+
26+
### Step 2: Verify Required Secrets
27+
28+
Ensure the following secrets are configured in your repository:
29+
30+
| Secret | Required | Description |
31+
|--------|----------|-------------|
32+
| `NUGET_API_KEY` | Optional | NuGet API key for publishing packages. If not set, publishing will be skipped. |
33+
| `GITHUB_TOKEN` | Automatic | Automatically provided by GitHub Actions |
34+
35+
To add the NuGet API key:
36+
1. Go to Repository Settings → Secrets and variables → Actions
37+
2. Click "New repository secret"
38+
3. Name: `NUGET_API_KEY`
39+
4. Value: Your NuGet API key from https://www.nuget.org/account/apikeys
40+
41+
### Step 3: Review Branch Configuration
42+
43+
The workflow triggers on pushes to `main` and `master` branches:
44+
45+
```yaml
46+
on:
47+
push:
48+
branches:
49+
- main
50+
- master
51+
```
52+
53+
If your default branch has a different name, update this in the workflow file.
54+
55+
### Step 4: Commit and Push
56+
57+
```bash
58+
git add .github/workflows/release.yml
59+
git commit -m "feat(ci): Enable automated release pipeline"
60+
git push origin main
61+
```
62+
63+
## How It Works
64+
65+
### Versioning Rules
66+
67+
The workflow analyzes commit messages since the last git tag:
68+
69+
| Commit Type | Version Bump | Example |
70+
|-------------|--------------|---------|
71+
| `BREAKING CHANGE:` or `!` | MAJOR | 0.0.5 → 1.0.0 |
72+
| `feat:` | MINOR | 0.0.5 → 0.1.0 |
73+
| `fix:` | MINOR | 0.0.5 → 0.1.0 |
74+
| `refactor:` | MINOR | 0.0.5 → 0.1.0 |
75+
| `perf:` | MINOR | 0.0.5 → 0.1.0 |
76+
| `docs:` | MINOR | 0.0.5 → 0.1.0 |
77+
| Other types | No release | - |
78+
79+
### Workflow Jobs
80+
81+
1. **version-and-build**
82+
- Parses commits and determines version
83+
- Creates git tag
84+
- Builds and tests project
85+
- Creates NuGet package
86+
- Verifies target frameworks (net462, net8.0)
87+
- Uploads package artifact
88+
89+
2. **publish-nuget**
90+
- Publishes to NuGet.org (if `NUGET_API_KEY` is set)
91+
- Handles duplicate versions gracefully with `--skip-duplicate`
92+
93+
3. **github-release**
94+
- Creates GitHub Release
95+
- Attaches NuGet package
96+
- Includes generated changelog
97+
98+
### Changelog Format
99+
100+
The workflow generates categorized changelogs:
101+
102+
```markdown
103+
## Changes in v0.1.0
104+
105+
### 🚨 Breaking Changes
106+
- Major API redesign
107+
108+
### ✨ Features
109+
- Add neural network support
110+
- Add convolutional layers
111+
112+
### 🐛 Bug Fixes
113+
- Fix memory leak in training loop
114+
115+
### ⚡ Performance Improvements
116+
- Optimize matrix multiplication
117+
118+
### ♻️ Code Refactoring
119+
- Simplify activation functions
120+
121+
### 📚 Documentation
122+
- Update API reference
123+
```
124+
125+
## Testing the Workflow
126+
127+
### Option 1: Push a Test Commit
128+
129+
```bash
130+
git commit --allow-empty -m "feat: Test automated release pipeline"
131+
git push origin main
132+
```
133+
134+
This will trigger the workflow and create version 0.1.0 (or next MINOR bump).
135+
136+
### Option 2: Manual Workflow Trigger
137+
138+
If you want to test without creating a release, you can add workflow_dispatch trigger:
139+
140+
```yaml
141+
on:
142+
push:
143+
branches:
144+
- main
145+
- master
146+
workflow_dispatch: # Add this for manual testing
147+
```
148+
149+
Then trigger it from Actions → Automated Release Pipeline → Run workflow.
150+
151+
## Conventional Commits
152+
153+
To use this workflow effectively, all commits must follow conventional commit format:
154+
155+
```
156+
<type>(<scope>): <description>
157+
158+
[optional body]
159+
160+
[optional footer]
161+
```
162+
163+
### Examples
164+
165+
```bash
166+
# Feature (MINOR bump)
167+
git commit -m "feat: add support for LSTM layers"
168+
169+
# Bug fix (MINOR bump)
170+
git commit -m "fix: correct gradient calculation in backpropagation"
171+
172+
# Breaking change (MAJOR bump)
173+
git commit -m "feat!: redesign tensor API
174+
175+
BREAKING CHANGE: Constructor signature has changed"
176+
177+
# Documentation (MINOR bump)
178+
git commit -m "docs: add API reference for neural networks"
179+
180+
# No release
181+
git commit -m "chore: update dependencies"
182+
```
183+
184+
See [CONVENTIONAL_COMMITS_GUIDE.md](CONVENTIONAL_COMMITS_GUIDE.md) for detailed guidance.
185+
186+
## Verification
187+
188+
After installation, verify the workflow is working:
189+
190+
1. **Check Workflow File**
191+
```bash
192+
ls -la .github/workflows/release.yml
193+
```
194+
195+
2. **View in GitHub**
196+
- Go to Actions tab in your repository
197+
- Look for "Automated Release Pipeline" workflow
198+
199+
3. **Test with a Commit**
200+
```bash
201+
git commit --allow-empty -m "feat: test automated release"
202+
git push origin main
203+
```
204+
205+
4. **Monitor Execution**
206+
- Go to Actions tab
207+
- Click on the running workflow
208+
- Watch logs for each job
209+
210+
## Troubleshooting
211+
212+
### Workflow Doesn't Trigger
213+
214+
**Problem**: Pushed to main but workflow didn't run.
215+
216+
**Solutions**:
217+
- Verify `.github/workflows/release.yml` exists (not in .github/)
218+
- Check branch name matches workflow trigger (main vs master)
219+
- Ensure GitHub Actions are enabled in repository settings
220+
221+
### No Release Created
222+
223+
**Problem**: Workflow runs but no release is created.
224+
225+
**Solutions**:
226+
- Ensure commits use conventional commit format (feat:, fix:, etc.)
227+
- Check workflow logs for "No conventional commits found"
228+
- Verify at least one commit since last tag
229+
230+
### NuGet Publish Fails
231+
232+
**Problem**: Package not published to NuGet.
233+
234+
**Solutions**:
235+
- Verify `NUGET_API_KEY` secret is configured
236+
- Check API key has not expired
237+
- Ensure package version doesn't already exist on NuGet
238+
- Review NuGet publish logs in workflow
239+
240+
### TFM Verification Fails
241+
242+
**Problem**: "Missing net462 lib in package" error.
243+
244+
**Solutions**:
245+
- Verify `src/AiDotNet.csproj` has:
246+
```xml
247+
<TargetFrameworks>net8.0;net462</TargetFrameworks>
248+
```
249+
- Ensure project builds successfully for both targets locally:
250+
```bash
251+
dotnet build src/AiDotNet.csproj -c Release
252+
```
253+
254+
### Permission Errors
255+
256+
**Problem**: "push declined due to repository rule violations"
257+
258+
**Solutions**:
259+
- Verify you have write access to the repository
260+
- Check branch protection rules allow workflow modifications
261+
- Ensure you're not trying to modify the workflow from a GitHub App
262+
263+
## Documentation
264+
265+
- [VERSIONING.md](VERSIONING.md) - Detailed versioning guide
266+
- [CONVENTIONAL_COMMITS_GUIDE.md](CONVENTIONAL_COMMITS_GUIDE.md) - Commit message guide
267+
- [AUTOMATED_RELEASE_WORKFLOW.yml](AUTOMATED_RELEASE_WORKFLOW.yml) - Workflow template
268+
269+
## Support
270+
271+
If you encounter issues:
272+
273+
1. Review workflow logs in the Actions tab
274+
2. Check the troubleshooting section above
275+
3. Verify all prerequisites are met
276+
4. Open an issue with logs and error messages
277+
278+
## Maintenance
279+
280+
### Updating the Workflow
281+
282+
To update the workflow:
283+
284+
1. Modify `.github/workflows/release.yml`
285+
2. Test changes on a feature branch first
286+
3. Merge to main when verified
287+
288+
### Disabling Auto-Release
289+
290+
To temporarily disable automatic releases:
291+
292+
```yaml
293+
on:
294+
workflow_dispatch: # Only manual triggers
295+
```
296+
297+
Or delete/rename `.github/workflows/release.yml`.
298+
299+
## Security Considerations
300+
301+
- **Secrets**: Never commit `NUGET_API_KEY` or other secrets to the repository
302+
- **Permissions**: The workflow uses minimal required permissions (contents: write)
303+
- **Dependencies**: GitHub Actions are pinned to specific versions (e.g., `@v4`)
304+
- **Validation**: All inputs are validated before creating releases
305+
306+
## Benefits
307+
308+
After installation, you get:
309+
310+
- **No Manual Versioning**: Version numbers determined automatically
311+
- **Consistent Releases**: Every release follows the same process
312+
- **Better Communication**: Changelogs generated from commits
313+
- **Faster Releases**: Push to main and release happens automatically
314+
- **Audit Trail**: All releases tracked in git tags and GitHub Releases
315+
- **Version Conflicts Handled**: `--skip-duplicate` prevents failures
316+
317+
## Next Steps
318+
319+
1. Install the workflow using instructions above
320+
2. Review [CONVENTIONAL_COMMITS_GUIDE.md](CONVENTIONAL_COMMITS_GUIDE.md)
321+
3. Update team documentation with commit message requirements
322+
4. Test with a feature commit
323+
5. Monitor first few releases to ensure everything works correctly
324+
325+
Happy releasing! 🚀

.github/BRANCH_PROTECTION.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)