74_deb-package-release #75

Merged
kfickel merged 6 commits from 74_deb-package-release into main 2026-04-03 13:57:02 +02:00
3 changed files with 190 additions and 2 deletions

View file

@ -0,0 +1,82 @@
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
release:
name: Build and Release
runs-on: nix
steps:
- name: Check out Repository
uses: https://git.konstantinfickel.de/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Extract version and handle tagging
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
# Manual trigger: read version from Cargo.toml
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
TAG="v${VERSION}"
# Check if tag already exists
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "::error::Version ${VERSION} is already released"
exit 1
fi
# Create and push the tag
git tag "$TAG"
git push origin "$TAG"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
else
# Tag push trigger: extract version from tag
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
fi
- name: Build .deb package
run: nix build .#streamd-deb -o result-deb
- name: Build static binary
run: nix build .#streamd-musl -o result-musl
- name: Prepare release artifacts
run: |
mkdir -p release
cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
- name: Create release
uses: https://code.forgejo.org/actions/forgejo-release@v2
with:
direction: upload
url: https://git.konstantinfickel.de
repo: kfickel/streamd
token: ${{ secrets.RELEASE_TOKEN }}
tag: ${{ steps.version.outputs.TAG }}
release-dir: release
release-notes: |
## streamd ${{ steps.version.outputs.VERSION }}
### Debian/Ubuntu
```bash
wget <release-url>/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
sudo dpkg -i streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
```
### Static binary
```bash
wget <release-url>/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
chmod +x streamd-*-linux-x86_64
sudo mv streamd-*-linux-x86_64 /usr/local/bin/streamd
```

View file

@ -4,6 +4,39 @@
Strea.md is a personal knowledge management and time-tracking CLI tool. It organizes time-ordered markdown files using `@tag` annotations, letting you manage tasks, track time, and query your notes from the terminal.
## Installation
### Debian/Ubuntu (.deb package)
Download and install the latest release:
```bash
wget https://git.konstantinfickel.de/kfickel/streamd/releases/download/vX.Y.Z/streamd_X.Y.Z_amd64.deb
sudo dpkg -i streamd_X.Y.Z_amd64.deb
```
This includes shell completions for bash, zsh, and fish.
### Static Binary
Download the statically-linked binary:
```bash
wget https://git.konstantinfickel.de/kfickel/streamd/releases/download/vX.Y.Z/streamd-X.Y.Z-linux-x86_64
chmod +x streamd-X.Y.Z-linux-x86_64
sudo mv streamd-X.Y.Z-linux-x86_64 /usr/local/bin/streamd
```
### Nix
Using the flake directly:
```bash
nix run git+https://git.konstantinfickel.de/kfickel/streamd
```
Or add to your NixOS/Home Manager configuration using the provided `homeManagerModules.default`.
## Core Concepts
- **Shards** — Sections of markdown files, organized hierarchically by headings. Each shard can contain markers, tags, and nested child shards.

View file

@ -30,6 +30,9 @@
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
# Read version from Cargo.toml as single source of truth
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
mkPkgs =
system:
import nixpkgs {
@ -58,7 +61,7 @@
commonArgs = {
src = craneLib.path ./.;
pname = "streamd";
version = "0.1.0";
inherit version;
strictDeps = true;
};
@ -102,15 +105,85 @@
commitizen.enable = true;
};
};
mkMuslCraneLib =
system:
let
pkgs = mkPkgs system;
toolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "x86_64-unknown-linux-musl" ];
};
in
(crane.mkLib pkgs).overrideToolchain toolchain;
mkStreamdMusl =
system:
let
craneLib = mkMuslCraneLib system;
commonArgs = {
src = craneLib.path ./.;
pname = "streamd";
inherit version;
strictDeps = true;
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
mkStreamdDeb =
system:
let
pkgs = mkPkgs system;
streamd-musl = mkStreamdMusl system;
in
pkgs.runCommand "streamd_${version}_amd64.deb" {
nativeBuildInputs = [ pkgs.nfpm ];
} ''
# Generate shell completions
mkdir -p completions
${streamd-musl}/bin/streamd completions bash > completions/streamd.bash
${streamd-musl}/bin/streamd completions zsh > completions/_streamd
${streamd-musl}/bin/streamd completions fish > completions/streamd.fish
cat > nfpm.yaml <<EOF
name: streamd
arch: amd64
platform: linux
version: "${version}"
maintainer: Konstantin Fickel
description: Personal knowledge management and time-tracking CLI using @Tag annotations
license: AGPL-3.0-only
homepage: https://git.konstantinfickel.de/kfickel/streamd
contents:
- src: ${streamd-musl}/bin/streamd
dst: /usr/bin/streamd
file_info:
mode: 0755
- src: completions/streamd.bash
dst: /usr/share/bash-completion/completions/streamd
- src: completions/_streamd
dst: /usr/share/zsh/vendor-completions/_streamd
- src: completions/streamd.fish
dst: /usr/share/fish/vendor_completions.d/streamd.fish
deb:
compression: gzip
EOF
nfpm package --config nfpm.yaml --packager deb --target $out
'';
in
{
packages = forAllSystems (
system:
let
streamd = mkStreamd system;
streamd-musl = mkStreamdMusl system;
streamd-deb = mkStreamdDeb system;
in
{
inherit streamd;
inherit streamd streamd-musl streamd-deb;
default = streamd;
}
);