streamd/.forgejo/workflows/release.yml
Konstantin Fickel 16218a8da7
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 1m41s
Continuous Integration / Build Package (push) Successful in 1m54s
fix: sed not installed, release pipeline fails
2026-04-03 14:06:44 +02:00

84 lines
2.7 KiB
YAML

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_LINE=$(grep '^version' Cargo.toml | head -1)
VERSION="${VERSION_LINE#*\"}"
VERSION="${VERSION%\"*}"
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
```