Compare commits

16 Commits
Author SHA1 Message Date
stefan 170c8ea981 fix(ci): add missing base_url to gitea-release plugin
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2026-03-29 17:24:55 +02:00
stefan 7dcf04c568 fix(ci): use golang image for release-notes step to ensure bash is available
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2026-03-29 17:18:22 +02:00
stefan b3d80f1ae3 ci: update release-notes step to use sh instead of bash
continuous-integration/drone/tag Build is failing
2026-03-29 17:14:21 +02:00
stefan 2410c16559 docs: prepare v0.6.0 release
continuous-integration/drone/tag Build is failing
2026-03-29 17:09:13 +02:00
stefan e25da626eb docs: add conventional changelog for upcoming v0.6.0 release 2026-03-29 17:06:24 +02:00
stefan 8d17f889f0 ci: auto-generate release notes from commits
continuous-integration/drone/push Build is passing
2026-03-29 16:49:27 +02:00
stefan 40834fdfce ci: fix trigger to run on push to all branches
continuous-integration/drone/push Build is passing
2026-03-29 16:40:38 +02:00
stefan b349586755 Merge branch 'master' into 'main': accept master drone config 2026-03-29 16:36:53 +02:00
stefan 109d62efa3 ci: run tests on all commits, release only on tags 2026-03-29 16:34:14 +02:00
stefan 5e8660ebd1 fix: correct drone.yml yaml schema - use arrays for event and status 2026-03-29 16:30:12 +02:00
stefan 0ebb212b65 docs: add release process documentation 2026-03-29 16:27:41 +02:00
stefan 91c2a313f2 ci: add tag-based release pipeline with coverage and source archive 2026-03-29 16:04:02 +02:00
stefan 05a61bba86 Generalize build
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2023-03-08 20:04:40 +00:00
stefan 2242ffd0cb Updated build container
continuous-integration/drone/push Build is passing
2023-03-08 19:38:57 +00:00
stefan eb050d5b84 Updated build container
continuous-integration/drone/push Build is passing
2023-03-08 19:35:44 +00:00
stefan f997c15873 No redirect
continuous-integration/drone/push Build is failing
2023-03-08 19:31:51 +00:00
5 changed files with 352 additions and 2 deletions
+48 -1
View File
@@ -2,6 +2,15 @@ kind: pipeline
type: docker
name: go-lib/util
trigger:
event:
- push
- tag
ref:
include:
- refs/heads/**
- refs/tags/v*
steps:
- name: test
image: golang:1.25.8
@@ -13,4 +22,42 @@ steps:
- go tool cover -func .build/coverage.out | tee .build/coverage.txt
- bash scripts/check-coverage.sh .build/coverage.out 80
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck -json ./... > vulncheck.json
- govulncheck -json ./... > vulncheck.json
- name: release-notes
image: golang:1.25.8
commands:
- bash scripts/generate-release-notes.sh
when:
event:
- tag
status:
- success
- name: package
image: golang:1.25.8
commands:
- tar czf .build/sources.tar.gz --exclude=.build --exclude=.git --exclude=.drone.yml .
when:
event:
- tag
status:
- success
- name: release
image: plugins/gitea-release
settings:
base_url: https://scm.yoorie.de
api_key:
from_secret: gitea_token
files:
- .build/coverage.txt
- .build/sources.tar.gz
- .build/release-notes.md
title: ${DRONE_TAG}
note_from_file: .build/release-notes.md
when:
event:
- tag
status:
- success
+52
View File
@@ -0,0 +1,52 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on Conventional Changelog categories.
## [v0.6.0] - 2026-03-29
### Added
- Added tag-based Gitea release workflow with attached artifacts.
- Added automatic release notes generation from commit history.
- Added release process documentation.
- Added project standards files, hooks, and reconciliation scripts.
### Changed
- Updated build container configuration.
- Generalized the Drone build flow for library usage.
- Improved Drone test execution, coverage reporting, and CI quality gates.
- Updated documentation structure and naming consistency.
- Synced AGENTS and Definition of Done templates.
### Fixed
- Fixed Drone YAML schema issues for trigger and status array types.
- Fixed Drone trigger behavior so push builds run on branches.
- Fixed Linux coverage flag handling in CI.
- Fixed formatting issues in Windows-specific code.
### Documentation
- Improved README and DoD documentation clarity.
- Enforced markdownlint rules for DoD documentation.
### CI
- Added `go vet` check to pipeline.
- Added coverage threshold validation (80%) in CI.
- Moved coverage validation into a dedicated script.
- Configured pipeline behavior: build on push and tag, release only on tag.
## [v0.5.0] - 2021-03-03
### Legacy Changes
- Added README.
- Updated modules and build setup.
- Renamed pipeline.
[v0.6.0]: https://scm.yoorie.de/git/go-lib/util/compare/v0.5.0...v0.6.0
[v0.5.0]: https://scm.yoorie.de/git/go-lib/util/compare/v0.0.4...v0.5.0
+1 -1
View File
@@ -57,4 +57,4 @@ func main() {
```
---
Copyright © 2023 yoorie.de
Copyright © 2026 yoorie.de
+180
View File
@@ -0,0 +1,180 @@
# Releasing go-lib/util
This document describes the process for creating a release of the
`go-lib/util` library.
## Overview
Releases in this project are managed via **Git tags**. When you push a
tag matching the pattern `v*` (e.g., `v0.5.0`), the Drone CI/CD
pipeline automatically:
1. Runs all quality checks (tests, coverage, vet, vulnerability scan)
2. Creates a source archive (`sources.tar.gz`)
3. Publishes a release to Gitea with both artifacts
## Release Types
This library follows **semantic versioning**: `MAJOR.MINOR.PATCH` (e.g., `v1.2.3`)
- `v1.0.0` - Major release (breaking API changes)
- `v1.1.0` - Minor release (new features, backward compatible)
- `v1.0.1` - Patch release (bug fixes only)
## Prerequisites
Before creating a release, ensure:
1. **All changes committed**: `git status` shows clean working tree
2. **Tests passing**: Run `go test ./...` locally
3. **Coverage OK**: Coverage must be ≥ 80%
4. **Dependencies updated**: Run `go mod tidy`
5. **CHANGELOG.md updated** (optional but recommended)
## Creating a Release
### Step 1: Prepare Release Commit (Optional)
Update version references if needed (README, docs, etc.):
```bash
# Edit any version references
vim README.md
git add README.md
git commit -m "docs: prepare v0.5.0 release"
```
### Step 2: Create the Git Tag
```bash
# Create annotated tag with release notes
git tag -a v0.5.0 -m "Release v0.5.0: Description of changes"
# Or simple tag (not recommended)
# git tag v0.5.0
```
### Step 3: Push the Tag
```bash
# Push tag to remote
git push origin v0.5.0
# Or push all tags at once
# git push --tags
```
### Step 4: Monitor the Pipeline
1. Navigate to your Drone instance (usually `https://drone.example.com`)
2. Watch the pipeline run through:
- ✓ Test & coverage checks
- ✓ Code quality (vet, vulnerability scan)
- ✓ Create source archive
- ✓ Publish to Gitea release
### Step 5: Verify Release in Gitea
1. Go to your repository on Gitea
2. Click "Releases" section
3. Verify the new release includes:
- Release title: `v0.5.0`
- Attached artifacts:
- `coverage.txt` - Test coverage report
- `sources.tar.gz` - Full source code snapshot
## Using the Released Version
End users can install your library via:
```bash
# Latest version
go get scm.yoorie.de/go-lib/util
# Specific version
go get scm.yoorie.de/go-lib/util@v0.5.0
# Latest patch of a minor version
go get scm.yoorie.de/go-lib/util@v0.5
```
## Tag Naming Convention
- **Release tags**: `v0.5.0` (pushed to trigger Drone pipeline)
- **Pre-release tags** (optional): `v0.5.0-rc1`, `v0.5.0-beta1`
- **Internal tags** (if any): Not recommended; use branches instead
Only tags matching `v*` trigger the release pipeline.
## Rollback / Deleting a Release
If a release has issues:
```bash
# Delete local tag
git tag -d v0.5.0
# Delete remote tag
git push origin :refs/tags/v0.5.0
# Then push a fixed release with the same or new tag
git tag -a v0.5.0-fixed -m "Fixed release"
git push origin v0.5.0-fixed
```
## Troubleshooting
### Pipeline Failed
Check Drone logs:
1. Go to Drone UI
2. Click on failed pipeline
3. Expand step details
4. Review error messages
Common issues:
- **Coverage below 80%**: Ensure tests cover new code
- **Tests failing**: Run locally: `go test -v ./...`
- **Vet errors**: Run: `go vet ./...`
### Release Not Appearing in Gitea
1. Verify `gitea_token` secret is set in Drone
2. Check Drone pipeline output for release step
3. Ensure tag matches pattern `v*`
### Tag Already Exists
If you pushed a tag and need to update it:
```bash
# Force delete and recreate (dangerous - use with caution)
git tag -d v0.5.0
git push origin :refs/tags/v0.5.0
git tag -a v0.5.0 -m "Updated release notes"
git push origin v0.5.0
```
## Release Checklist
- [ ] All code changes reviewed and merged
- [ ] Tests pass locally: `go test -v ./...`
- [ ] Coverage ≥ 80%: Test and check coverage
- [ ] Code quality OK: `go vet ./...`
- [ ] No vulnerabilities: `govulncheck ./...`
- [ ] Dependencies tidy: `go mod tidy`
- [ ] CHANGELOG updated (if maintained)
- [ ] Version references updated (if any)
- [ ] Git tag created: `git tag -a vX.Y.Z -m "message"`
- [ ] Tag pushed: `git push origin vX.Y.Z`
- [ ] Release visible in Gitea
- [ ] Coverage artifact downloaded and verified
## Further Reading
- [Semantic Versioning](https://semver.org/)
- [Go Modules](https://golang.org/doc/modules)
- [Drone CI Documentation](https://docs.drone.io/)
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
# Generate release notes from commits since the last tag
set -e
CURRENT_TAG="${1:-${DRONE_TAG}}"
OUTPUT_FILE="${2:-.build/release-notes.md}"
if [ -z "$CURRENT_TAG" ]; then
echo "Error: Current tag not provided"
exit 1
fi
# Find the previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "$CURRENT_TAG"^ 2>/dev/null || echo "")
mkdir -p "$(dirname "$OUTPUT_FILE")"
# Start release notes
{
echo "# Release $CURRENT_TAG"
echo ""
if [ -n "$PREVIOUS_TAG" ]; then
echo "**Changes since $PREVIOUS_TAG:**"
echo ""
# Extract commits and group by type (feat, fix, docs, ci, etc.)
git log "$PREVIOUS_TAG..$CURRENT_TAG" --pretty=format:"%s" | while read -r commit; do
# Parse conventional commits
if [[ $commit =~ ^([a-z]+)(\(.+\))?:\ (.+)$ ]]; then
TYPE="${BASH_REMATCH[1]}"
SCOPE="${BASH_REMATCH[2]}"
MESSAGE="${BASH_REMATCH[3]}"
case "$TYPE" in
feat)
echo "- ✨ **Feature**${SCOPE}: $MESSAGE" ;;
fix)
echo "- 🐛 **Fix**${SCOPE}: $MESSAGE" ;;
docs)
echo "- 📖 **Docs**${SCOPE}: $MESSAGE" ;;
ci)
echo "- 🔧 **CI**${SCOPE}: $MESSAGE" ;;
test)
echo "- ✅ **Test**${SCOPE}: $MESSAGE" ;;
refactor)
echo "- ♻️ **Refactor**${SCOPE}: $MESSAGE" ;;
perf)
echo "- ⚡ **Performance**${SCOPE}: $MESSAGE" ;;
*)
echo "- 📝 $commit" ;;
esac
else
echo "- 📝 $commit"
fi
done
else
echo "Initial release"
echo ""
git log "$CURRENT_TAG" --pretty=format:"- 📝 %s" | head -20
fi
echo ""
echo "---"
echo "See [all changes](https://scm.yoorie.de/git/go-lib/util/compare/$PREVIOUS_TAG...$CURRENT_TAG)"
} > "$OUTPUT_FILE"
echo "Release notes generated: $OUTPUT_FILE"
cat "$OUTPUT_FILE"