-
-
Notifications
You must be signed in to change notification settings - Fork 10
126 lines (116 loc) · 4.48 KB
/
publish-unstable.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
on:
workflow_call:
inputs:
dotnet-version:
required: false
default: "8.0.x"
description: "The .NET version to setup for the build"
type: string
dotnet-target:
required: false
default: "net8.0"
description: "The .NET target to set for JPRM"
type: string
secrets:
deploy-host:
required: true
deploy-user:
required: true
deploy-key:
required: true
token:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: 'unstable'
- name: Setup .NET
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4.2.0
with:
dotnet-version: "${{ inputs.dotnet-version }}"
- name: Update prerelease dependencies
id: unstable
run: |
dotnet nuget add source --username jellyfin-bot --password ${{ secrets.token }} --store-password-in-clear-text --name jellyfin-pre "https://nuget.pkg.github.com/jellyfin/index.json"
dotnet tool install --global dotnet-outdated-tool
dotnet outdated -pre Always -u -inc Jellyfin
- name: Generate version number using date and run number
id: version-creator
run: |
pluginVersion=`yq '.version' build.yaml | tr -d '"'`
buildDay=`date +%y%m`
runNum=$GITHUB_RUN_NUMBER
ver="${pluginVersion}.${buildDay}.${runNum}.0"
echo "PLUGIN_VERSION=$ver" >> $GITHUB_OUTPUT
- name: Build Jellyfin Plugin
uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1
id: jprm
with:
dotnet-target: "${{ inputs.dotnet-target }}"
version: ${{ steps.version-creator.outputs.PLUGIN_VERSION }}
- name: Upload Artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: build-artifact
- name: Ensure Destination Path Exists
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
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/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/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/main/plugin-unstable/manifest.json"
JELLYFIN_REPO_URL: "https://repo.jellyfin.org/files/plugin-unstable/"
steps:
- name: Update Plugin Manifest
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
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/incoming/plugin/${{ github.repository }}/${{ inputs.version }}" || exit 1
(
flock -x 300
sudo /usr/local/bin/jprm --verbosity=debug repo add --url="${JELLYFIN_REPO_URL}" "${JELLYFIN_REPO}" ./*.zip || exit 1
) 300>${lockfile}
popd || exit 1
rm -r "/srv/incoming/plugin/${{ github.repository }}/${{ inputs.version }}" || exit 1