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:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -20,45 +18,44 @@ jobs:
|
||||||
- name: Extract version and handle tagging
|
- name: Extract version and handle tagging
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
# Read version from Cargo.toml
|
||||||
# Manual trigger: read version from Cargo.toml
|
VERSION_LINE=$(grep '^version' Cargo.toml | head -1)
|
||||||
VERSION_LINE=$(grep '^version' Cargo.toml | head -1)
|
VERSION="${VERSION_LINE#*\"}"
|
||||||
VERSION="${VERSION_LINE#*\"}"
|
VERSION="${VERSION%\"*}"
|
||||||
VERSION="${VERSION%\"*}"
|
TAG="v${VERSION}"
|
||||||
TAG="v${VERSION}"
|
|
||||||
|
|
||||||
# Check if tag already exists
|
# Check if tag already exists
|
||||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||||
echo "::error::Version ${VERSION} is already released"
|
echo "Tag ${TAG} already exists, skipping release"
|
||||||
exit 1
|
echo "SKIP=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
exit 0
|
||||||
|
|
||||||
# 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
|
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
|
- name: Build .deb package
|
||||||
|
if: steps.version.outputs.SKIP != 'true'
|
||||||
run: nix build .#streamd-deb -o result-deb
|
run: nix build .#streamd-deb -o result-deb
|
||||||
|
|
||||||
- name: Build static binary
|
- name: Build static binary
|
||||||
|
if: steps.version.outputs.SKIP != 'true'
|
||||||
run: nix build .#streamd-musl -o result-musl
|
run: nix build .#streamd-musl -o result-musl
|
||||||
|
|
||||||
- name: Prepare release artifacts
|
- name: Prepare release artifacts
|
||||||
|
if: steps.version.outputs.SKIP != 'true'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
|
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-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
|
if: steps.version.outputs.SKIP != 'true'
|
||||||
uses: https://git.konstantinfickel.de/actions/forgejo-release@v2
|
uses: https://git.konstantinfickel.de/actions/forgejo-release@v2
|
||||||
with:
|
with:
|
||||||
direction: upload
|
direction: upload
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue