Duncan Tourolle a8d3968925
Some checks failed
🏗️ Build Plugin / build (push) Failing after 1m12s
🧪 Test Plugin / test (push) Failing after 12s
gitea ci workflows
2025-11-14 20:26:52 +01:00

101 lines
3.1 KiB
YAML

name: '🚀 Release Plugin'
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v1.0.0)'
required: true
type: string
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Get version
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION}"
- name: Update build.yaml with version
run: |
VERSION="${{ steps.get_version.outputs.version_number }}"
sed -i "s/^version:.*/version: \"${VERSION}\"/" build.yaml
cat build.yaml
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Install JPRM
run: |
pip install --user jprm
- name: Build Jellyfin Plugin
id: jprm
run: |
# Build plugin using JPRM
python -m jprm --verbosity=debug plugin build ./
# Find the generated zip file
ARTIFACT=$(find . -name "*.zip" -type f -print -quit)
ARTIFACT_NAME=$(basename "${ARTIFACT}")
echo "artifact=${ARTIFACT}" >> $GITHUB_OUTPUT
echo "artifact_name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
echo "Found artifact: ${ARTIFACT}"
- name: Generate changelog
id: changelog
run: |
# Get commits since last tag
PREV_TAG=$(git tag --sort=-creatordate | grep -v "${{ steps.get_version.outputs.version }}" | head -n 1)
if [ -z "$PREV_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
else
CHANGELOG=$(git log ${PREV_TAG}..${{ steps.get_version.outputs.version }} --pretty=format:"- %s (%h)" --no-merges)
fi
# Save to file for release notes
echo "## What's Changed" > RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "${CHANGELOG}" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "**Full Changelog**: ${PREV_TAG}...${{ steps.get_version.outputs.version }}" >> RELEASE_NOTES.md
- name: Create Release
uses: actions/gitea-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
files: |
${{ steps.jprm.outputs.artifact }}
build.yaml