Add gitea workflows
This commit is contained in:
parent
2bcc7733b6
commit
945c550901
61
.gitea/workflows/build.yaml
Normal file
61
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: '🏗️ Build Plugin'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Verify .NET installation
|
||||||
|
run: dotnet --version
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore Jellyfin.Plugin.Jellypod.sln
|
||||||
|
|
||||||
|
- name: Build solution
|
||||||
|
run: dotnet build Jellyfin.Plugin.Jellypod.sln --configuration Release --no-restore --no-self-contained
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: dotnet test Jellyfin.Plugin.Jellypod.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)
|
||||||
|
echo "artifact=${ARTIFACT}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Found artifact: ${ARTIFACT}"
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jellypod-plugin
|
||||||
|
path: ${{ steps.jprm.outputs.artifact }}
|
||||||
|
retention-days: 30
|
||||||
|
if-no-files-found: error
|
||||||
128
.gitea/workflows/release.yaml
Normal file
128
.gitea/workflows/release.yaml
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
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.Jellypod.sln
|
||||||
|
|
||||||
|
- name: Build solution
|
||||||
|
run: dotnet build Jellyfin.Plugin.Jellypod.sln --configuration Release --no-restore --no-self-contained
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: dotnet test Jellyfin.Plugin.Jellypod.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: Create Release
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
# Get repository information
|
||||||
|
REPO_OWNER="${{ github.repository_owner }}"
|
||||||
|
REPO_NAME="${{ github.event.repository.name }}"
|
||||||
|
GITEA_URL="${{ github.server_url }}"
|
||||||
|
|
||||||
|
# Prepare release body
|
||||||
|
RELEASE_BODY="Jellypod Jellyfin Plugin ${{ steps.get_version.outputs.version }}\n\nSee attached files for plugin installation."
|
||||||
|
RELEASE_BODY_JSON=$(echo -n "${RELEASE_BODY}" | jq -Rs .)
|
||||||
|
|
||||||
|
# Create release using Gitea API
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases" \
|
||||||
|
-d "{
|
||||||
|
\"tag_name\": \"${{ steps.get_version.outputs.version }}\",
|
||||||
|
\"name\": \"Release ${{ steps.get_version.outputs.version }}\",
|
||||||
|
\"body\": ${RELEASE_BODY_JSON},
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": false
|
||||||
|
}")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||||
|
BODY=$(echo "$RESPONSE" | sed '$d')
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
|
||||||
|
RELEASE_ID=$(echo "$BODY" | jq -r '.id')
|
||||||
|
echo "Created release with ID: ${RELEASE_ID}"
|
||||||
|
else
|
||||||
|
echo "Failed to create release. HTTP ${HTTP_CODE}"
|
||||||
|
echo "$BODY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Upload plugin artifact
|
||||||
|
echo "Uploading plugin artifact..."
|
||||||
|
curl -f -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
--data-binary "@${{ steps.jprm.outputs.artifact }}" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets?name=${{ steps.jprm.outputs.artifact_name }}"
|
||||||
|
|
||||||
|
# Upload build.yaml
|
||||||
|
echo "Uploading build.yaml..."
|
||||||
|
curl -f -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/x-yaml" \
|
||||||
|
--data-binary "@build.yaml" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets?name=build.yaml"
|
||||||
|
|
||||||
|
echo "Release created successfully!"
|
||||||
|
echo "View at: ${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/tag/${{ steps.get_version.outputs.version }}"
|
||||||
44
.gitea/workflows/test.yaml
Normal file
44
.gitea/workflows/test.yaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
name: '🧪 Test Plugin'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Verify .NET installation
|
||||||
|
run: dotnet --version
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore Jellyfin.Plugin.Jellypod.sln
|
||||||
|
|
||||||
|
- name: Build solution
|
||||||
|
run: dotnet build Jellyfin.Plugin.Jellypod.sln --configuration Debug --no-restore --no-self-contained
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: dotnet test Jellyfin.Plugin.Jellypod.sln --no-build --configuration Debug --verbosity normal --logger "trx;LogFileName=test-results.trx"
|
||||||
|
|
||||||
|
- name: Upload test results
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: test-results
|
||||||
|
path: '**/test-results.trx'
|
||||||
|
retention-days: 7
|
||||||
@ -14,5 +14,9 @@ owner: "jellyfin"
|
|||||||
artifacts:
|
artifacts:
|
||||||
- "Jellyfin.Plugin.Jellypod.dll"
|
- "Jellyfin.Plugin.Jellypod.dll"
|
||||||
- "System.ServiceModel.Syndication.dll"
|
- "System.ServiceModel.Syndication.dll"
|
||||||
|
build_type: "dotnet"
|
||||||
|
dotnet_configuration: "Release"
|
||||||
|
dotnet_framework: "net8.0"
|
||||||
|
project: "Jellyfin.Plugin.Jellypod/Jellyfin.Plugin.Jellypod.csproj"
|
||||||
changelog: >
|
changelog: >
|
||||||
Initial release
|
Initial release
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user