From 19a9e6a72e50fbcc38ad0a18865f1a208d3143e6 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Fri, 3 Apr 2026 16:01:15 +0200 Subject: [PATCH] ci: change release pipeline to run on every push --- .forgejo/workflows/release.yml | 47 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 0db21a7..755c0d5 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -2,8 +2,6 @@ name: Release on: push: - tags: - - 'v*' workflow_dispatch: jobs: @@ -20,45 +18,44 @@ jobs: - 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}" + # 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 + # 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: 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 - name: Create release + if: steps.version.outputs.SKIP != 'true' uses: https://git.konstantinfickel.de/actions/forgejo-release@v2 with: direction: upload