Update build

This commit is contained in:
cxfksword
2022-10-11 14:41:11 +08:00
parent 0d621ef64d
commit 31bf127bfb
4 changed files with 76 additions and 149 deletions

View File

@@ -8,31 +8,16 @@ on:
jobs:
build:
strategy:
inputs:
dotnet-version:
required: false
default: "6.0.x"
description: "The .NET version to setup for the build"
type: string
dotnet-target:
required: false
default: "net6.0"
description: "The .NET target to set for JPRM"
type: string
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
- name: Setup .NET
uses: actions/setup-dotnet@45c9f236cf9a0c09d11298348f6ed06bd81914c0 # tag=v3.0.1
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "${{ inputs.dotnet-version }}"
dotnet-version: 6.0.x
- name: Build Jellyfin Plugin
uses: oddstr13/jellyfin-plugin-repository-manager@a7795e010e63a6dcbbd5e6d8274f801d021f1045 # tag=v0.5.0
uses: oddstr13/jellyfin-plugin-repository-manager@v0.5.0
id: jprm
with:
dotnet-target: "${{ inputs.dotnet-target }}"
dotnet-target: "net6.0"

View File

@@ -6,126 +6,35 @@ on:
jobs:
build:
strategy:
inputs:
version:
required: true
type: string
is-unstable:
required: false
default: false
type: boolean
dotnet-version:
required: false
default: "6.0.x"
description: "The .NET version to setup for the build"
type: string
dotnet-target:
required: false
default: "net6.0"
description: "The .NET target to set for JPRM"
type: string
secrets:
deploy-host:
required: true
deploy-user:
required: true
deploy-key:
required: true
runs-on: ubuntu-latest
name: Build & Release
steps:
- name: Checkout Repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
- name: Setup .NET
uses: actions/setup-dotnet@45c9f236cf9a0c09d11298348f6ed06bd81914c0 # tag=v3.0.1
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "${{ inputs.dotnet-version }}"
- name: Build Jellyfin Plugin
uses: oddstr13/jellyfin-plugin-repository-manager@a7795e010e63a6dcbbd5e6d8274f801d021f1045 # tag=v0.5.0
id: jprm
dotnet-version: 6.0.x
- name: Restore nuget packages
run: dotnet restore Shokofin/Shokofin.csproj
- name: Setup python
uses: actions/setup-python@v2
with:
dotnet-target: "${{ inputs.dotnet-target }}"
- name: Upload Artifact
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
python-version: 3.8
- name: Install JPRM
run: python -m pip install jprm
- name: Run JPRM
run: python build_plugin.py --version=${GITHUB_REF#refs/*/}
- name: Update release
uses: svenstaro/upload-release-action@v2
with:
name: build-artifact
retention-days: 30
if-no-files-found: error
path: ${{ steps.jprm.outputs.artifact }}
upload:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v3.0.0
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./artifacts/danmu_*.zip
tag: ${{ github.ref }}
file_glob: true
- name: Update manifest
uses: stefanzweifel/git-auto-commit-action@v4
with:
name: build-artifact
- name: Prepare GH Release Assets
run: |-
for file in ./*; do
md5sum ${file#./} >> ${file%.*}.md5
sha256sum ${file#./} >> ${file%.*}.sha256
done
ls -l
- name: Upload GH Release Assets
uses: shogo82148/actions-upload-release-asset@8dbaa4469aa7256e70624d72f2567fac8f5341b3 # tag=v1.6.2
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./*
- name: Ensure Destination Path Exists
uses: appleboy/ssh-action@f9010ff7f1bbd7db1a0b4bab661437550cea20c0 # tag=v0.1.5
if: ${{ contains(github.repository, 'jellyfin/') }}
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
script_stop: true
script: |-
mkdir -p "/srv/repository/incoming/plugin/${{ github.repository }}/${{ inputs.version }}" || exit 1
- name: Upload Jellyfin Plugin Repository Assets
uses: burnett01/rsync-deployments@0dc935cdecc5f5e571865e60d2a6cdc673704823 # tag=5.2
if: ${{ contains(github.repository, 'jellyfin/') }}
with:
switches: -vrptz
path: ./*.zip
remote_path: /srv/repository/incoming/plugin/${{ github.repository }}/${{ inputs.version }}
remote_host: ${{ secrets.deploy-host }}
remote_user: ${{ secrets.deploy-user }}
remote_key: ${{ secrets.deploy-key }}
publish:
needs:
- upload
runs-on: ubuntu-latest
if: ${{ contains(github.repository, 'jellyfin/') }}
env:
JELLYFIN_REPO: "/srv/repository/mirror/releases/plugin/manifest-stable.json"
JELLYFIN_REPO_URL: "https://repo.jellyfin.org/releases/plugin/"
steps:
- name: Update Plugin Manifest
uses: appleboy/ssh-action@f9010ff7f1bbd7db1a0b4bab661437550cea20c0 # tag=v0.1.5
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
script_stop: true
envs: JELLYFIN_REPO,JELLYFIN_REPO_URL
script: |-
lockfile="/run/lock/jprm.lock"
pushd "/srv/repository/incoming/plugin/${{ github.repository }}/${{ inputs.version }}" || exit 1
(
flock -x 300
jprm --verbosity=debug repo add --url="${JELLYFIN_REPO_URL}" "${JELLYFIN_REPO}" ./*.zip || exit 1
) 300>${lockfile}
popd || exit 1
rm -r "/srv/repository/incoming/plugin/${{ github.repository }}/${{ inputs.version }}" || exit 1
branch: master
commit_message: Update repo manifest
file_pattern: manifest.json