Skip to content

Commit 1fe6ee8

Browse files
committed
release scripts
1 parent 8cf5fcf commit 1fe6ee8

4 files changed

Lines changed: 251 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fishez"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2024"
55

66
[dependencies]

RELEASE_GUIDE.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Release Guide
2+
3+
This guide explains how to properly release new versions of Fishez using GitLab CI/CD.
4+
5+
## Quick Release Process
6+
7+
### 1. Run the automated release script
8+
```bash
9+
./scripts/release.sh 0.2.0
10+
```
11+
12+
This will:
13+
- Update `Cargo.toml` version
14+
- Update `CHANGELOG.md`
15+
- Create a git tag
16+
17+
### 2. Push changes to trigger CI/CD
18+
```bash
19+
git push origin main
20+
git push origin 0.2.0
21+
```
22+
23+
### 3. Monitor GitLab CI
24+
- Go to: `https://gitlab.com/ioma8/fishez/-/pipelines`
25+
- Watch the release pipeline run automatically
26+
- The pipeline will build and create the release
27+
28+
### 4. Verify release
29+
- Go to: `https://gitlab.com/ioma8/fishez/-/releases`
30+
- Check that the release was created successfully
31+
- Download the binary if needed
32+
33+
## Manual Release Process
34+
35+
### Step 1: Update Version in Cargo.toml
36+
```toml
37+
version = "0.2.0" # Change from "0.1.0" to new version
38+
```
39+
40+
### Step 2: Update CHANGELOG.md
41+
```markdown
42+
## [Unreleased]
43+
44+
### Added
45+
- New features for this version
46+
47+
## [0.2.0] - 2024-02-16
48+
49+
### Added
50+
- Feature 1
51+
- Feature 2
52+
53+
[Unreleased]: https://github.com/ioma8/fishez/compare/v0.2.0...HEAD
54+
[0.2.0]: https://github.com/ioma8/fishez/releases/tag/v0.2.0
55+
```
56+
57+
### Step 3: Create and Push Tag
58+
```bash
59+
git tag -a 0.2.0 -m "Release fishez 0.2.0"
60+
git push origin 0.2.0
61+
```
62+
63+
### Step 4: Update README.md (Optional)
64+
If needed, update version numbers in the README.
65+
66+
## Understanding the CI/CD Pipeline
67+
68+
### Pipeline Stages
69+
1. **Test**: Unit tests and integration tests
70+
2. **Quality**: Clippy, fmt, tree check, binary size
71+
3. **Build**: Release binary compilation
72+
4. **Docs**: HTML documentation generation
73+
5. **Security**: Vulnerability scanning
74+
6. **Release**: Automated release creation
75+
76+
### What Gets Created
77+
- **Binary**: `target/release/fishez` (uploaded as release asset)
78+
- **Documentation**: `target/doc/` (uploaded as release asset)
79+
- **GitLab Release**: Created automatically with tag
80+
81+
### Release Artifacts
82+
- **Binary**: Executable for your OS
83+
- **Documentation**: HTML docs with `index.html`
84+
85+
## After Release
86+
87+
### 1. Update README.md
88+
Update version references and any feature lists if changed.
89+
90+
### 2. Commit and Push
91+
```bash
92+
git add .
93+
git commit -m "Prepare release v0.2.0"
94+
git push origin main
95+
```
96+
97+
### 3. Verify Release on GitHub/GitLab
98+
- Check that all tests pass
99+
- Verify the release page looks correct
100+
- Test downloading the binary if needed
101+
102+
### 4. Update Unreleased Section
103+
```bash
104+
# After release, update CHANGELOG.md:
105+
sed -i.bak 's/\[Unreleased\]/[0.2.0] - $(date +%Y-%m-%d)/' CHANGELOG.md
106+
rm CHANGELOG.md.bak
107+
```
108+
109+
## Troubleshooting
110+
111+
### Tag not triggering release
112+
- Check that the tag name matches the version exactly (e.g., `0.2.0` not `v0.2.0`)
113+
- Verify the tag was pushed: `git ls-remote --tags origin`
114+
- Check GitLab CI logs for errors
115+
116+
### Build failures
117+
- Run local: `make release-ci`
118+
- Check for compilation errors
119+
- Review CI logs for specific failures
120+
121+
### Release not created
122+
- Verify all pipeline stages pass
123+
- Check that the release stage has a tag ref
124+
- Ensure release assets are being uploaded
125+
126+
## Best Practices
127+
128+
1. **Semantic Versioning**: Follow MAJOR.MINOR.PATCH format
129+
2. **Test Thoroughly**: Run tests before releasing
130+
3. **Update Changelog**: Document all changes
131+
4. **Tag Immediately**: Create tag right after version change
132+
5. **Push Both**: Push both main branch and tag
133+
6. **Review CI**: Check all pipeline stages pass
134+
7. **Binary Test**: Verify binary works on your system
135+
136+
## Rollback Procedure
137+
138+
If a release needs to be reverted:
139+
140+
```bash
141+
# Delete the release from GitLab (via web interface)
142+
# Delete the tag
143+
git tag -d 0.2.0
144+
git push origin :refs/tags/0.2.0
145+
146+
# Reset version in Cargo.toml
147+
# Revert CHANGELOG.md
148+
```
149+
150+
## Creating a Pre-release
151+
152+
For testing before official release:
153+
154+
```bash
155+
# Use pre-release version suffix (e.g., 0.2.0-alpha.1)
156+
./scripts/release.sh 0.2.0-alpha.1
157+
158+
# Push tag
159+
git push origin 0.2.0-alpha.1
160+
```
161+
162+
## Checking Pipeline Status
163+
164+
```bash
165+
# Check pipeline status
166+
curl -s "https://gitlab.com/api/v4/projects/ioma8%2Ffishez/pipelines?ref=main" \
167+
-H "PRIVATE-TOKEN: <your_token>" | jq
168+
169+
# Or visit: https://gitlab.com/ioma8/fishez/-/pipelines
170+
```
171+
172+
## References
173+
174+
- [GitLab CI/CD Documentation](https://docs.gitlab.com/ee/ci/)
175+
- [Semantic Versioning](https://semver.org/)
176+
- [Rust Release Process](https://doc.rust-lang.org/cargo/guide/releasing.html)

scripts/release.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# Release script for Fishez
3+
# Usage: ./scripts/release.sh <version>
4+
5+
set -e
6+
7+
VERSION=${1:-0.2.0}
8+
PREV_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
9+
10+
if [ "$PREV_VERSION" == "$VERSION" ]; then
11+
echo "Error: Version $VERSION is already set in Cargo.toml"
12+
exit 1
13+
fi
14+
15+
echo "📦 Releasing Fishez version $VERSION"
16+
echo "Previous version: $PREV_VERSION"
17+
echo ""
18+
19+
# 1. Update version in Cargo.toml
20+
echo "📝 Updating version in Cargo.toml..."
21+
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
22+
rm Cargo.toml.bak
23+
24+
# 2. Update CHANGELOG.md
25+
echo "📝 Updating CHANGELOG.md..."
26+
sed -i.bak "/## \[Unreleased\]/,/^## \[/ {
27+
/^## \[Unreleased\]/ {
28+
N
29+
s/Unreleased\]\n\n### Added/Unreleased\]\n\n## [$VERSION] - $(date +%Y-%m-%d)\n### Added/
30+
}
31+
/^## \[/ {
32+
n
33+
s/\[.*\] - $(date +%Y-%m-%d)/[$VERSION] - $(date +%Y-%m-%d) - Upcoming/
34+
}
35+
}" CHANGELOG.md
36+
rm CHANGELOG.md.bak
37+
38+
# 3. Update version in CHANGELOG.md if not already done
39+
if ! grep -q "\[$VERSION\]" CHANGELOG.md; then
40+
sed -i.bak "/## \[Unreleased\]/,/^## \[/ {
41+
/^## \[Unreleased\]/ {
42+
N
43+
s/Unreleased\]\n\n### Added/Unreleased\]\n\n## [$VERSION] - $(date +%Y-%m-%d)\n### Added/
44+
}
45+
}" CHANGELOG.md
46+
rm CHANGELOG.md.bak
47+
fi
48+
49+
# 4. Create git tag
50+
echo "🏷️ Creating git tag $VERSION..."
51+
git tag -a "$VERSION" -m "Release fishez $VERSION"
52+
53+
# 5. Show changes
54+
echo ""
55+
echo "📋 Summary of changes:"
56+
echo " - Version updated: $PREV_VERSION -> $VERSION"
57+
echo " - CHANGELOG.md updated"
58+
echo " - Git tag created: $VERSION"
59+
60+
# 6. Show instructions for pushing
61+
echo ""
62+
echo "🚀 To complete the release, push the changes and tag:"
63+
echo " git push origin main"
64+
echo " git push origin $VERSION"
65+
66+
# 7. Verify release pipeline will run
67+
echo ""
68+
echo "✅ GitLab CI will automatically:"
69+
echo " - Build release binary"
70+
echo " - Run all tests"
71+
echo " - Generate documentation"
72+
echo " - Create release with binary artifacts"
73+
echo " - Create GitLab release page"

0 commit comments

Comments
 (0)