ci: change release pipeline to run on every push
This commit is contained in:
parent
7564ce01d5
commit
19a9e6a72e
1 changed files with 22 additions and 25 deletions
|
|
@ -2,8 +2,6 @@ name: Release
|
|||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
|
@ -20,8 +18,7 @@ jobs:
|
|||
- name: Extract version and handle tagging
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
# Manual trigger: read version from Cargo.toml
|
||||
# Read version from Cargo.toml
|
||||
VERSION_LINE=$(grep '^version' Cargo.toml | head -1)
|
||||
VERSION="${VERSION_LINE#*\"}"
|
||||
VERSION="${VERSION%\"*}"
|
||||
|
|
@ -29,8 +26,9 @@ jobs:
|
|||
|
||||
# Check if tag already exists
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "::error::Version ${VERSION} is already released"
|
||||
exit 1
|
||||
echo "Tag ${TAG} already exists, skipping release"
|
||||
echo "SKIP=true" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create and push the tag
|
||||
|
|
@ -39,26 +37,25 @@ jobs:
|
|||
|
||||
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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue