name: Release on: push: branches: - main 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: | # 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 "Tag ${TAG} already exists, skipping release" echo "SKIP=true" >> $GITHUB_OUTPUT exit 0 fi # Create and push the tag git tag "$TAG" git push origin "$TAG" echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT echo "TAG=${TAG}" >> $GITHUB_OUTPUT echo "SKIP=false" >> $GITHUB_OUTPUT - name: Build .deb package if: steps.version.outputs.SKIP != 'true' run: nix build .#streamd-deb -o result-deb - name: Build static binary if: steps.version.outputs.SKIP != 'true' run: nix build .#streamd-musl -o result-musl - name: Build Windows binary if: steps.version.outputs.SKIP != 'true' run: nix build .#streamd-windows -o result-windows - name: Build Zed extension if: steps.version.outputs.SKIP != 'true' run: nix build .#zed-extension-zip -o result-zed-extension-zip - name: Prepare release artifacts if: steps.version.outputs.SKIP != 'true' 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 cp result-windows/bin/streamd.exe release/streamd-${{ steps.version.outputs.VERSION }}-windows-x86_64.exe cp result-zed-extension-zip release/streamd-zed-extension-${{ steps.version.outputs.VERSION }}.zip - name: Create release if: steps.version.outputs.SKIP != 'true' uses: https://git.konstantinfickel.de/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 verbose: true