latest build pipeline
This commit is contained in:
parent
0a2d6a558c
commit
462c8a7c7b
112
.gitea/workflows/latest.yaml
Normal file
112
.gitea/workflows/latest.yaml
Normal file
@ -0,0 +1,112 @@
|
||||
name: 'Latest Release'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'manifest.json'
|
||||
|
||||
jobs:
|
||||
latest-release:
|
||||
runs-on: linux/amd64
|
||||
container:
|
||||
image: gitea.tourolle.paris/dtourolle/srfplay-builder:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: build-${{ github.run_id }}
|
||||
|
||||
- name: Restore dependencies
|
||||
working-directory: build-${{ github.run_id }}
|
||||
run: dotnet restore Jellyfin.Plugin.SRFPlay.sln
|
||||
|
||||
- name: Build solution
|
||||
working-directory: build-${{ github.run_id }}
|
||||
run: dotnet build Jellyfin.Plugin.SRFPlay.sln --configuration Release --no-restore --no-self-contained /m:1
|
||||
|
||||
- name: Run tests
|
||||
working-directory: build-${{ github.run_id }}
|
||||
run: dotnet test Jellyfin.Plugin.SRFPlay.sln --no-build --configuration Release --verbosity normal
|
||||
|
||||
- name: Build Jellyfin Plugin
|
||||
id: jprm
|
||||
working-directory: build-${{ github.run_id }}
|
||||
run: |
|
||||
jprm --verbosity=debug plugin build ./
|
||||
ARTIFACT=$(find . -name "*.zip" -type f -print -quit | sed 's|^\./||')
|
||||
echo "artifact=${ARTIFACT}" >> $GITHUB_OUTPUT
|
||||
echo "Found artifact: ${ARTIFACT}"
|
||||
|
||||
- name: Create or update latest release
|
||||
working-directory: build-${{ github.run_id }}
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
REPO_OWNER="${{ github.repository_owner }}"
|
||||
REPO_NAME="${{ github.event.repository.name }}"
|
||||
GITEA_URL="${{ github.server_url }}"
|
||||
TAG="latest"
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||
|
||||
# Delete existing 'latest' release if it exists
|
||||
EXISTING=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${TAG}")
|
||||
|
||||
if [ "$EXISTING" = "200" ]; then
|
||||
RELEASE_ID=$(curl -s \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${TAG}" | jq -r '.id')
|
||||
|
||||
echo "Deleting existing latest release (ID: ${RELEASE_ID})..."
|
||||
curl -s -X DELETE \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}"
|
||||
fi
|
||||
|
||||
# Delete existing 'latest' tag if it exists
|
||||
curl -s -X DELETE \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/tags/${TAG}" || true
|
||||
|
||||
# Create new release
|
||||
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 "$(jq -n \
|
||||
--arg tag "$TAG" \
|
||||
--arg name "Latest Build" \
|
||||
--arg body "Automated build from master branch.\n\nCommit: ${SHORT_SHA}\nBuilt: ${TIMESTAMP}" \
|
||||
--arg target "${{ github.sha }}" \
|
||||
'{tag_name: $tag, name: $name, body: $body, target_commitish: $target, draft: false, prerelease: true}')")
|
||||
|
||||
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
|
||||
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=srfplay_latest.zip"
|
||||
|
||||
echo "Latest release updated successfully!"
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: rm -rf build-${{ github.run_id }}
|
||||
@ -308,7 +308,7 @@ public class RecordingService : IRecordingService, IDisposable
|
||||
public async Task ProcessRecordingsAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// Prevent overlapping scheduler runs from spawning duplicate ffmpeg processes
|
||||
if (!await _processLock.WaitAsync(0).ConfigureAwait(false))
|
||||
if (!await _processLock.WaitAsync(0, CancellationToken.None).ConfigureAwait(false))
|
||||
{
|
||||
_logger.LogDebug("ProcessRecordingsAsync already running, skipping");
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user