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://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