Open Source Release
A comprehensive workflow for managing releases, changelogs, cross-platform builds, and checksums.
Complete Jakefile
Section titled “Complete Jakefile”# Open Source Project Jakefile# ============================
@dotenv@require GITHUB_TOKEN
# Project metadataname = "myproject"version = "1.0.0"repo = "username/myproject"
# Cross-compilation targetstargets = "x86_64-linux aarch64-linux x86_64-macos aarch64-macos x86_64-windows"
# === Core Development ===
@defaulttask all: [build, test] echo "Development build complete!"
task build: @needs cargo @pre echo "Building {{name}} v{{version}}..." cargo build --release @post echo "Binary: target/release/{{name}}"
task test: @needs cargo @pre echo "Running tests..." cargo test --all @post echo "All tests passed!"
task lint: @needs cargo cargo clippy -- -D warnings cargo fmt --check
task format: @needs cargo cargo fmt
task check: [lint, test] echo "All checks passed - ready to commit!"
# === Documentation ===
@group docstask docs: @description "Generate documentation" @needs cargo cargo doc --no-deps --open
@group docstask docs-build: @description "Build docs for publishing" @needs cargo cargo doc --no-deps echo "Documentation built: target/doc/"
# === Release Pipeline ===
@group releasetask release-build: @description "Build release binaries for all platforms" @needs cross @pre echo "Building for all platforms..." mkdir -p dist @each {{targets}} echo "Building for {{item}}..." @if contains("{{item}}", "windows") cross build --release --target {{item}}-gnu cp target/{{item}}-gnu/release/{{name}}.exe dist/{{name}}-{{item}}.exe @else cross build --release --target {{item}} cp target/{{item}}/release/{{name}} dist/{{name}}-{{item}} @end @end @post echo "All platforms built!"
@group releasetask checksums: [release-build] @description "Generate SHA256 checksums" @cd dist shasum -a 256 {{name}}-* > checksums.txt echo "Checksums: dist/checksums.txt"
@group releasetask release-package: [checksums] @description "Create release archive" @require VERSION @confirm "Create release package for v$VERSION?" mkdir -p releases/v$VERSION cp dist/* releases/v$VERSION/ cp CHANGELOG.md releases/v$VERSION/ cp LICENSE releases/v$VERSION/ echo "Release packaged: releases/v$VERSION/"
# === Changelog Management ===
@group releasetask changelog-check: @description "Verify CHANGELOG has unreleased changes" @if exists(CHANGELOG.md) grep -q "## \[Unreleased\]" CHANGELOG.md && \ grep -A 100 "## \[Unreleased\]" CHANGELOG.md | grep -q "^### " || \ (echo "Error: No unreleased changes in CHANGELOG.md" && exit 1) echo "Changelog has unreleased changes - good!" @else echo "Error: CHANGELOG.md not found" exit 1 @end
@group releasetask changelog-release: @description "Convert Unreleased to version entry" @require VERSION @needs sed @pre echo "Updating CHANGELOG.md for v$VERSION..." sed -i.bak "s/## \[Unreleased\]/## [Unreleased]\n\n## [$VERSION] - $(date +%Y-%m-%d)/" CHANGELOG.md rm CHANGELOG.md.bak @post echo "CHANGELOG.md updated"
# === Version Management ===
@group releasetask version-bump: @description "Bump version in project files" @require VERSION @confirm "Bump version to $VERSION?" sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml rm Cargo.toml.bak @if exists(package.json) npm version $VERSION --no-git-tag-version @end echo "Version bumped to $VERSION"
@group releasetask release: [check, changelog-check] @description "Full release workflow" @require VERSION @confirm "Release v$VERSION to GitHub?"
# Prepare release echo "Preparing release v$VERSION..." jake version-bump VERSION=$VERSION jake changelog-release VERSION=$VERSION jake release-package VERSION=$VERSION
# Git operations git add -A git commit -m "chore: release v$VERSION" git tag -a "v$VERSION" -m "Release v$VERSION"
# Push git push origin main git push origin "v$VERSION"
# Create GitHub release gh release create "v$VERSION" \ --title "v$VERSION" \ --notes-file CHANGELOG.md \ releases/v$VERSION/*
echo "Released v$VERSION!"
# === CI Helpers ===
task ci: [lint, test, docs-build] @description "Run CI checks locally" echo "CI simulation passed!"
# === Cleanup ===
task clean: cargo clean rm -rf dist/ rm -rf releases/ echo "Cleaned all build artifacts"jake # Build and testjake check # Full quality checksjake release-build # Cross-compile all platformsjake checksums # Generate SHA256 checksumsVERSION=2.0.0 jake release # Full release workflowjake ci # Simulate CI locallyKey Features
Section titled “Key Features”Cross-Platform Builds
Section titled “Cross-Platform Builds”Uses @each to iterate over targets:
@each {{targets}} cross build --release --target {{item}}@endChangelog Automation
Section titled “Changelog Automation”Validates and updates CHANGELOG.md following Keep a Changelog format:
task changelog-check: grep -q "## \[Unreleased\]" CHANGELOG.mdComplete Release Flow
Section titled “Complete Release Flow”The release task orchestrates the entire process:
- Run quality checks
- Validate changelog
- Bump version numbers
- Update changelog
- Create Git tag
- Push to GitHub
- Create GitHub release with assets
Customization
Section titled “Customization”Update the metadata at the top:
name = "myproject";version = "1.0.0";repo = "username/myproject";targets = "x86_64-linux aarch64-linux x86_64-macos aarch64-macos";See Also
Section titled “See Also”- Environment Validation -
@requireand@needs - Parallel Execution - Speed up cross-platform builds