97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
name: Publish Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: |
|
|
9.x
|
|
10.x
|
|
|
|
- name: Extract version
|
|
id: ver
|
|
run: |
|
|
RAW="${GITHUB_REF_NAME#v}"
|
|
PARTS=$(echo "$RAW" | tr '.' '\n' | wc -l)
|
|
if [ "$PARTS" -eq 3 ]; then RAW="${RAW}.0"; fi
|
|
echo "ver=$RAW" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build net9.0
|
|
run: dotnet publish AutoBackup.csproj -c Release -f net9.0 --nologo
|
|
|
|
- name: Build net10.0
|
|
run: dotnet publish AutoBackup.csproj -c Release -f net10.0 --nologo
|
|
|
|
- name: Install jprm
|
|
run: pip install jprm --break-system-packages
|
|
|
|
- name: Package artifacts
|
|
run: |
|
|
mkdir -p artifacts
|
|
VER="${{ steps.ver.outputs.ver }}"
|
|
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
|
|
write_meta() {
|
|
local DIR=$1 ABI=$2
|
|
cat > "${DIR}/meta.json" <<EOF
|
|
{
|
|
"category": "General",
|
|
"guid": "1175543c-6d20-4cfa-93a6-1476836df34c",
|
|
"name": "Auto Backup",
|
|
"description": "Automated scheduled ZIP backups of Jellyfin data.",
|
|
"overview": "Automated scheduled ZIP backups of Jellyfin data.",
|
|
"owner": "Filtik",
|
|
"version": "${VER}",
|
|
"targetAbi": "${ABI}",
|
|
"timestamp": "${TIMESTAMP}",
|
|
"changelog": ""
|
|
}
|
|
EOF
|
|
}
|
|
|
|
write_meta "publish/net9.0" "10.9.0.0"
|
|
cd publish/net9.0
|
|
zip -j "${GITHUB_WORKSPACE}/artifacts/autobackup_${VER}_net9.zip" \
|
|
Jellyfin.Plugin.AutoBackup.dll meta.json
|
|
cd "${GITHUB_WORKSPACE}"
|
|
|
|
write_meta "publish/net10.0" "12.0.0.0"
|
|
cd publish/net10.0
|
|
zip -j "${GITHUB_WORKSPACE}/artifacts/autobackup_${VER}_net10.zip" \
|
|
Jellyfin.Plugin.AutoBackup.dll meta.json
|
|
cd "${GITHUB_WORKSPACE}"
|
|
|
|
- name: Update manifest.json
|
|
run: |
|
|
jprm repo add \
|
|
--url="${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/" \
|
|
. \
|
|
artifacts/*.zip
|
|
|
|
- name: Commit manifest.json
|
|
run: |
|
|
git config user.name "gitea-actions"
|
|
git config user.email "actions@noreply.local"
|
|
git add manifest.json
|
|
git diff --staged --quiet || git commit -m "chore: update manifest for ${{ github.ref_name }}"
|
|
git push origin HEAD:${{ github.event.repository.default_branch }}
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/*.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|