parent
1263e961d9
commit
952d04435d
|
|
@ -8,75 +8,51 @@ on:
|
|||
jobs:
|
||||
build-net9:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PIP_BREAK_SYSTEM_PACKAGES: "1"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set version from tag
|
||||
run: |
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
sed -i "s|<Version>.*</Version>|<Version>${VER}</Version>|" AutoBackup.csproj
|
||||
sed -i "s|<AssemblyVersion>.*</AssemblyVersion>|<AssemblyVersion>${VER}</AssemblyVersion>|" AutoBackup.csproj
|
||||
sed -i "s|<FileVersion>.*</FileVersion>|<FileVersion>${VER}</FileVersion>|" AutoBackup.csproj
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: |
|
||||
9.0.x
|
||||
10.0.x
|
||||
|
||||
- name: Build (net9.0 / Jellyfin 10.x)
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@v1.1.1
|
||||
id: jprm
|
||||
with:
|
||||
dotnet-target: "net9.0"
|
||||
|
||||
- name: Remove meta.json from artifact
|
||||
run: zip -d "${{ steps.jprm.outputs.artifact }}" meta.json 2>/dev/null || true
|
||||
- name: Build and package (net9.0 / Jellyfin 10.x)
|
||||
run: |
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
dotnet publish AutoBackup.csproj -f net9.0 -c Release \
|
||||
-p:Version=${VER} -p:AssemblyVersion=${VER} -p:FileVersion=${VER} \
|
||||
-o publish/net9
|
||||
zip -j "autobackup-net9.zip" publish/net9/Jellyfin.Plugin.AutoBackup.dll
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-net9
|
||||
path: ${{ steps.jprm.outputs.artifact }}
|
||||
path: autobackup-net9.zip
|
||||
|
||||
build-net10:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PIP_BREAK_SYSTEM_PACKAGES: "1"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set version from tag
|
||||
run: |
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
sed -i "s|<Version>.*</Version>|<Version>${VER}</Version>|" AutoBackup.csproj
|
||||
sed -i "s|<AssemblyVersion>.*</AssemblyVersion>|<AssemblyVersion>${VER}</AssemblyVersion>|" AutoBackup.csproj
|
||||
sed -i "s|<FileVersion>.*</FileVersion>|<FileVersion>${VER}</FileVersion>|" AutoBackup.csproj
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: |
|
||||
9.0.x
|
||||
10.0.x
|
||||
|
||||
- name: Set targetAbi for Jellyfin 12.x
|
||||
- name: Build and package (net10.0 / Jellyfin 12.x)
|
||||
run: |
|
||||
sed -i "s/targetAbi:.*/targetAbi: \"12.0.0.0\"/" build.yaml
|
||||
|
||||
- name: Build (net10.0 / Jellyfin 12.x)
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@v1.1.1
|
||||
id: jprm
|
||||
with:
|
||||
dotnet-target: "net10.0"
|
||||
|
||||
- name: Remove meta.json from artifact
|
||||
run: zip -d "${{ steps.jprm.outputs.artifact }}" meta.json 2>/dev/null || true
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
dotnet publish AutoBackup.csproj -f net10.0 -c Release \
|
||||
-p:Version=${VER} -p:AssemblyVersion=${VER} -p:FileVersion=${VER} \
|
||||
-o publish/net10
|
||||
zip -j "autobackup-net10.zip" publish/net10/Jellyfin.Plugin.AutoBackup.dll
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-net10
|
||||
path: ${{ steps.jprm.outputs.artifact }}
|
||||
path: autobackup-net10.zip
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -103,8 +79,8 @@ jobs:
|
|||
- name: Rename artifacts
|
||||
run: |
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
mv artifacts/build-net9/*.zip "artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip"
|
||||
mv artifacts/build-net10/*.zip "artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"
|
||||
mv artifacts/build-net9/autobackup-net9.zip "artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip"
|
||||
mv artifacts/build-net10/autobackup-net10.zip "artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"
|
||||
|
||||
- name: Update manifest.json
|
||||
run: |
|
||||
|
|
@ -184,39 +160,29 @@ jobs:
|
|||
VER="${GITHUB_REF_NAME#v}"
|
||||
BODY=$(python3 -c "import sys,json,os; print(json.dumps(os.environ.get('CHANGELOG','').strip()))")
|
||||
|
||||
# Create release or get existing
|
||||
# Delete existing release if present
|
||||
EXISTING=$(curl -s "${API}/repos/${REPO}/releases/tags/${TAG}" \
|
||||
-H "Authorization: token ${TOKEN}")
|
||||
EXISTING_ID=$(echo "${EXISTING}" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('id',''))" 2>/dev/null || true)
|
||||
if [ -n "${EXISTING_ID}" ]; then
|
||||
echo "Deleting existing release ${EXISTING_ID}..."
|
||||
curl -s -X DELETE "${API}/repos/${REPO}/releases/${EXISTING_ID}" \
|
||||
-H "Authorization: token ${TOKEN}"
|
||||
fi
|
||||
|
||||
# Create fresh release
|
||||
RELEASE=$(curl -s -X POST "${API}/repos/${REPO}/releases" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":${BODY}}")
|
||||
RELEASE_ID=$(echo "${RELEASE}" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('id',''))" 2>/dev/null || true)
|
||||
if [ -z "${RELEASE_ID}" ]; then
|
||||
RELEASE=$(curl -s "${API}/repos/${REPO}/releases/tags/${TAG}" \
|
||||
-H "Authorization: token ${TOKEN}")
|
||||
RELEASE_ID=$(echo "${RELEASE}" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||
fi
|
||||
echo "Release ID: ${RELEASE_ID}"
|
||||
|
||||
# Upload assets (delete existing with same name first)
|
||||
# Upload assets
|
||||
for file in \
|
||||
"artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip" \
|
||||
"artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"; do
|
||||
NAME=$(basename "${file}")
|
||||
|
||||
ASSETS=$(curl -s "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${TOKEN}")
|
||||
ASSET_ID=$(echo "${ASSETS}" | python3 -c "
|
||||
import sys,json
|
||||
assets=json.load(sys.stdin)
|
||||
a=next((x for x in assets if x['name']=='${NAME}'),None)
|
||||
print(a['id'] if a else '')
|
||||
" 2>/dev/null || true)
|
||||
if [ -n "${ASSET_ID}" ]; then
|
||||
echo "Deleting existing asset ${NAME} (id=${ASSET_ID})..."
|
||||
curl -s -X DELETE "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets/${ASSET_ID}" \
|
||||
-H "Authorization: token ${TOKEN}"
|
||||
fi
|
||||
|
||||
echo "Uploading ${NAME}..."
|
||||
HTTP_CODE=$(curl -s -o /tmp/upload_response.json -w "%{http_code}" \
|
||||
-X POST "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${NAME}" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue