103 lines
3.3 KiB
YAML
103 lines
3.3 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: Verify .NET installation
|
|
run: dotnet --version
|
|
|
|
- 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 Jellyfin.Plugin.SRFPlay.sln
|
|
|
|
- name: Build solution
|
|
run: dotnet build Jellyfin.Plugin.SRFPlay.sln --configuration Release --no-restore --no-self-contained
|
|
|
|
- name: Run tests
|
|
run: dotnet test Jellyfin.Plugin.SRFPlay.sln --no-build --configuration Release --verbosity normal
|
|
|
|
- name: Install JPRM
|
|
run: |
|
|
python3 -m venv /tmp/jprm-venv
|
|
/tmp/jprm-venv/bin/pip install jprm
|
|
|
|
- name: Build Jellyfin Plugin
|
|
id: jprm
|
|
run: |
|
|
# Create artifacts directory for JPRM output
|
|
mkdir -p artifacts
|
|
|
|
# Build plugin using JPRM
|
|
/tmp/jprm-venv/bin/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
|