This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "自定义插件打包" | |
on: | |
workflow_dispatch: | |
push: | |
tags: ["*"] | |
env: | |
dotnet-version: 8.0.x | |
python-version: 3.8 | |
project: Jellyfin.Plugin.Danmu/Jellyfin.Plugin.Danmu.csproj | |
artifact: danmu | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build & Release | |
steps: | |
- uses: actions/checkout@v3 | |
- with: | |
ref: jellyfin/main | |
- name: Get tags (For CHANGELOG) | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
id: dotnet | |
with: | |
dotnet-version: ${{ env.dotnet-version }} | |
- name: Change default dotnet version | |
run: | | |
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Initialize workflow variables | |
id: vars | |
run: | | |
VERSION=$(echo "${GITHUB_REF#refs/*/}" | sed s/^v//) | |
VERSION="$VERSION.0" | |
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
echo "APP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT | |
- name: Build | |
run: | | |
dotnet restore ${{ env.project }} --no-cache | |
dotnet publish --nologo --no-restore --configuration=Release --framework=net8.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }} | |
mkdir -p artifacts | |
zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.Danmu/bin/Release/net8.0/Jellyfin.Plugin.Danmu.dll | |
- name: Generate manifest | |
run: python3 ./scripts/generate_manifest.py ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/} | |
env: | |
CN_DOMAIN: ${{ vars.CN_DOMAIN }} | |
- name: Publish release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./artifacts/${{ env.artifact }}_*.zip | |
tag: ${{ github.ref }} | |
release_name: '${{ github.ref_name }}: Jellyfin v10.9' | |
overwrite: true | |
file_glob: true | |
- name: Publish manifest | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./manifest*.json | |
tag: "manifest" | |
overwrite: true | |
file_glob: true |