Update build script
This commit is contained in:
parent
a964167a04
commit
7d14da34ae
|
@ -17,6 +17,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
run: dotnet build --no-restore
|
||||
# - name: Test
|
||||
# run: dotnet test --no-restore --verbosity normal
|
||||
|
|
|
@ -8,9 +8,7 @@ env:
|
|||
dotnet-version: 6.0.x
|
||||
python-version: 3.8
|
||||
project: Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
|
||||
branch: main
|
||||
artifact: metashark
|
||||
manifest: https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -25,8 +23,24 @@ jobs:
|
|||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: ${{ env.dotnet-version }}
|
||||
- name: Restore nuget packages
|
||||
run: dotnet restore ${{ env.project }} # 需要指定项目,要不然会同时build多个项目导致出错
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
run: |
|
||||
VERSION=$(echo "${GITHUB_REF#refs/*/}" | sed s/^v//)
|
||||
VERSION="$VERSION.0"
|
||||
echo ::set-output name=VERSION::${VERSION}
|
||||
echo ::set-output name=APP_NAME::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ${{ env.project }} --no-cache
|
||||
- name: Build
|
||||
run: dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 --output=artifacts -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }}
|
||||
- name: Compress build files
|
||||
uses: thedoctor0/zip-release@main
|
||||
with:
|
||||
type: "zip"
|
||||
directory: "artifacts"
|
||||
filename: "artifacts.zip"
|
||||
exclusions: "*.json *.pdb"
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
|
@ -34,25 +48,19 @@ jobs:
|
|||
- name: Install JPRM
|
||||
run: python -m pip install jprm
|
||||
- name: Run JPRM
|
||||
run: chmod +x ./build_plugin.sh && ./build_plugin.sh ${{ env.artifact }} ${GITHUB_REF#refs/*/}
|
||||
- name: Update release
|
||||
run: chmod +x ./build_plugin.sh && ./build_plugin.sh ${{ env.artifact }} ${{steps.vars.outputs.VERSION}} ${GITHUB_REF#refs/*/}
|
||||
- name: Publish release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./artifacts/${{ env.artifact }}_*.zip
|
||||
file: ./${{ env.artifact }}/${{ env.artifact }}_*.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
- name: Update manifest
|
||||
- name: Publish manifest
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./*.json
|
||||
file: ./manifest*.json
|
||||
tag: "manifest"
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
# - name: Update manifest
|
||||
# uses: stefanzweifel/git-auto-commit-action@v4
|
||||
# with:
|
||||
# branch: ${{ env.branch }}
|
||||
# commit_message: Update repo manifest
|
||||
# file_pattern: "*.json"
|
||||
|
|
|
@ -4,3 +4,6 @@ obj/
|
|||
.idea/
|
||||
artifacts
|
||||
**/.DS_Store
|
||||
metashark/
|
||||
manifest_cn.json
|
||||
manifest.json
|
|
@ -1,23 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.2" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jellyfin.Plugin.MetaShark\Jellyfin.Plugin.MetaShark.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.2" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jellyfin.Plugin.MetaShark\Jellyfin.Plugin.MetaShark.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -8,23 +8,29 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
|
||||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AngleSharp" Version="0.17.1" />
|
||||
<PackageReference Include="AnitomySharp" Version="0.2.0" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.8.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3">
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.0">
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.8.0">
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -29,7 +29,7 @@ jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TMDB
|
|||
|
||||
```sh
|
||||
$ dotnet restore
|
||||
$ dotnet publish Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
|
||||
$ dotnet publish -c Release Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
|
||||
```
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ $ dotnet publish Jellyfin.Plugin.MetaShark/Jellyfin.Plugin.MetaShark.csproj
|
|||
|
||||
1. Build the plugin
|
||||
|
||||
2. Create a folder, like `metashark` and copy `bin/Release/Jellyfin.Plugin.MetaShark.dll` into it
|
||||
2. Create a folder, like `metashark` and copy `bin/Release/net6.0/*.dll` into it
|
||||
|
||||
3. Move folder `metashark` to jellyfin `data/plugin` folder
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"category": "Metadata",
|
||||
"changelog": "NA",
|
||||
"description": "jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TMDB补充缺失的季数据和剧集数据。",
|
||||
"guid": "9a19103f-16f7-4668-be54-9a1e7a4f7556",
|
||||
"imageUrl": "https://github.com/cxfksword/jellyfin-plugin-metashark/raw/main/doc/logo.png",
|
||||
"name": "MetaShark",
|
||||
"overview": "jellyfin电影元数据插件",
|
||||
"owner": "cxfksword",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"timestamp": "1970-01-01T00:00:00Z",
|
||||
"version": "1.0.0.0"
|
||||
}
|
15
build.yaml
15
build.yaml
|
@ -1,15 +0,0 @@
|
|||
name: "MetaShark"
|
||||
guid: "9A19103F-16F7-4668-BE54-9A1E7A4F7556"
|
||||
imageUrl: https://github.com/cxfksword/jellyfin-plugin-metashark/raw/main/doc/logo.png
|
||||
version: "1.0.0.0"
|
||||
targetAbi: "10.8.0.0"
|
||||
framework: "net6.0"
|
||||
owner: "cxfksword"
|
||||
overview: "jellyfin电影元数据插件"
|
||||
description: >
|
||||
jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TMDB补充缺失的季数据和剧集数据。
|
||||
category: "Metadata"
|
||||
artifacts:
|
||||
- "Jellyfin.Plugin.MetaShark.dll"
|
||||
changelog: >
|
||||
NA
|
|
@ -2,21 +2,18 @@
|
|||
|
||||
# $1 from github action
|
||||
ARTIFACT=$1
|
||||
TAG=$2
|
||||
VERSION=$2
|
||||
TAG=$3
|
||||
|
||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H:%M:%S')
|
||||
WORK_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
ARTIFACT_DIR="${WORK_DIR}/artifacts"
|
||||
mkdir -p "${ARTIFACT_DIR}"
|
||||
ARTIFACT_ZIP_FILE="${WORK_DIR}/artifacts/artifacts.zip"
|
||||
ARTIFACT_META="${WORK_DIR}/build.meta.json"
|
||||
|
||||
JELLYFIN_REPO_URL="https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download"
|
||||
JELLYFIN_MANIFEST="${WORK_DIR}/manifest.json"
|
||||
JELLYFIN_MANIFEST_CN="${WORK_DIR}/manifest_cn.json"
|
||||
JELLYFIN_MANIFEST_OLD="https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json"
|
||||
BUILD_YAML_FILE="${WORK_DIR}/build.yaml"
|
||||
|
||||
|
||||
VERSION=$(echo "$TAG" | sed s/^v//) # remove v prefix
|
||||
VERSION="$VERSION.0" # .NET dll need major.minor[.build[.revision]] version format
|
||||
|
||||
# download old manifest
|
||||
wget -q -O "$JELLYFIN_MANIFEST" "$JELLYFIN_MANIFEST_OLD"
|
||||
|
@ -25,14 +22,16 @@ if [ $? -ne 0 ]; then
|
|||
jprm repo init $WORK_DIR
|
||||
fi
|
||||
|
||||
# update change log from tag message
|
||||
# update meta json message
|
||||
cp -f "${ARTIFACT_META}" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
CHANGELOG=$(git tag -l --format='%(contents)' ${TAG})
|
||||
sed -i "s@NA@$CHANGELOG@" $BUILD_YAML_FILE # mac build need change to: -i ''
|
||||
sed -i "s@NA@$CHANGELOG@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
sed -i "s@1.0.0.0@$VERSION@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
sed -i "s@1970-01-01T00:00:00Z@$CURRENT_DATE@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
|
||||
# build and generate new manifest
|
||||
zipfile=$(jprm --verbosity=debug plugin build "." --output="${ARTIFACT_DIR}" --version="${VERSION}" --dotnet-framework="net6.0") && {
|
||||
jprm --verbosity=debug repo add --url=${JELLYFIN_REPO_URL} "${JELLYFIN_MANIFEST}" "${zipfile}"
|
||||
}
|
||||
|
||||
# generate new manifest
|
||||
jprm --verbosity=debug repo add --url=${JELLYFIN_REPO_URL} "${JELLYFIN_MANIFEST}" "${ARTIFACT_ZIP_FILE}"
|
||||
|
||||
# fix menifest download url
|
||||
sed -i "s@/${ARTIFACT}@/$TAG@" "$JELLYFIN_MANIFEST"
|
||||
|
|
Loading…
Reference in New Issue