Skip to main content
flake-release automates the release process for Nix flake packages, handling version bumping, changelog generation, and git tagging.

Installation

Run directly

nix run github:spotdemo4/nur#flake-release

Add to flake

devShells.default = pkgs.mkShell {
  packages = with pkgs.trev; [
    flake-release
  ];
};

Usage

Create a release

flake-release
This will:
  1. Analyze commits since last release
  2. Determine version bump (major, minor, or patch)
  3. Update version in flake.nix
  4. Generate changelog
  5. Create git tag
  6. Push changes and tag

Specify version bump

Manually specify the type of version bump:
flake-release --bump major
flake-release --bump minor
flake-release --bump patch

Dry run

Preview changes without applying them:
flake-release --dry-run

Workflow integration

GitHub Actions

Automate releases with GitHub Actions:
.github/workflows/release.yml
name: Release

on:
  workflow_dispatch:
    inputs:
      bump:
        description: 'Version bump type'
        required: true
        type: choice
        options:
          - patch
          - minor
          - major

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - uses: cachix/install-nix-action@v27
        with:
          extra_nix_config: |
            extra-substituters = https://nix.trev.zip
            extra-trusted-public-keys = trev:I39N/EsnHkvfmsbx8RUW+ia5dOzojTQNCTzKYij1chU=
      
      - name: Create release
        run: |
          nix run github:spotdemo4/nur#flake-release -- --bump ${{ github.event.inputs.bump }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Features

  • Semantic versioning: Automatic version bumping based on commits
  • Changelog generation: Generate changelogs from git history
  • Git integration: Automatic tagging and pushing
  • Conventional commits: Parse conventional commit messages
  • Dry run mode: Preview changes before applying

Configuration

Create a .flake-release.toml file to customize behavior:
[release]
changelog = true
tag_prefix = "v"
push = true

[changelog]
file = "CHANGELOG.md"
format = "markdown"
flake-release expects your flake.nix to include version information in the package metadata. Make sure your packages expose a version attribute.

Build docs developers (and LLMs) love