diff --git a/.github/workflows/build-upload-publish-dev.yml b/.github/workflows/build-upload-publish-dev.yml new file mode 100644 index 00000000..b1eced27 --- /dev/null +++ b/.github/workflows/build-upload-publish-dev.yml @@ -0,0 +1,43 @@ +# $schema: https://json.schemastore.org/github-workflow +name: 'Build and release plugin (dev)' + +on: + pull_request: + branches: + - main + paths-ignore: + - '**/*.md' + - '**/*.yml' + - '**/*.yaml' + workflow_dispatch: + +jobs: + test: + uses: jellyfin/jellyfin-meta-plugins/.github/workflows/test.yaml@master + with: + dotnet-version: "8.0" + + build: + uses: ./.github/workflows/build.yml + + upload-repo: + if: ${{ contains(github.repository, 'lyarenei/') }} + needs: build + uses: ./.github/workflows/upload-repo.yml + with: + repo: "jellyfin-dev" + secrets: + host: ${{ secrets.DEPLOY_HOST }} + user: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_KEY }} + + publish: + if: ${{ contains(github.repository, 'lyarenei/') }} + needs: upload-repo + uses: ./.github/workflows/publish.yml + with: + repo: "jellyfin-dev" + secrets: + host: ${{ secrets.DEPLOY_HOST }} + user: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/build-upload-publish.yml b/.github/workflows/build-upload-publish.yml new file mode 100644 index 00000000..6081e4c9 --- /dev/null +++ b/.github/workflows/build-upload-publish.yml @@ -0,0 +1,44 @@ +# $schema: https://json.schemastore.org/github-workflow +name: 'Build and release plugin' + +on: + release: + types: + - released + workflow_dispatch: + +jobs: + test: + uses: jellyfin/jellyfin-meta-plugins/.github/workflows/test.yaml@master + with: + dotnet-version: "8.0" + + build: + needs: test + uses: ./.github/workflows/build.yml + + upload: + needs: build + uses: ./.github/workflows/upload.yml + + upload-repo: + if: ${{ contains(github.repository, 'lyarenei/') }} + needs: build + uses: ./.github/workflows/upload-repo.yml + with: + repo: "jellyfin" + secrets: + host: ${{ secrets.DEPLOY_HOST }} + user: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_KEY }} + + publish: + if: ${{ contains(github.repository, 'lyarenei/') }} + needs: upload + uses: ./.github/workflows/publish.yml + with: + repo: "jellyfin" + secrets: + host: ${{ secrets.DEPLOY_HOST }} + user: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 766c9137..81b871bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,38 @@ +# $schema: https://json.schemastore.org/github-workflow name: 'Build Plugin' on: - push: - branches: - - main - paths-ignore: - - '**/*.md' - - '**/*.yml' - - '**/*.yaml' - pull_request: - branches: - - main - paths-ignore: - - '**/*.md' - - '**/*.yml' - - '**/*.yaml' - workflow_dispatch: + workflow_call: + inputs: + dotnet-version: + type: string + required: false + default: "8.0" + dotnet-target: + type: string + required: false + default: "net8.0" jobs: build: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup .NET - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 with: - dotnet-version: "8.0" + dotnet-version: "${{ inputs.dotnet-version }}" - name: Build Jellyfin Plugin - uses: oddstr13/jellyfin-plugin-repository-manager@eabb903cdac8a7f6d94df887c6910b5720ec48f9 # v1.0.11 + uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1 id: jprm + with: + dotnet-target: "${{ inputs.dotnet-target }}" - name: Upload Artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: build-artifact retention-days: 14 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 34e00855..c24fa5a3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,99 +1,34 @@ +# $schema: https://json.schemastore.org/github-workflow name: 'Publish Plugin' on: - release: - types: - - released - workflow_dispatch: + workflow_call: + inputs: + repo: + type: string + required: true + secrets: + host: + required: true + user: + required: true + key: + required: true jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - - name: Setup .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3.0.3 - with: - dotnet-version: "${{ inputs.dotnet-version }}" - - - name: Build Jellyfin Plugin - uses: oddstr13/jellyfin-plugin-repository-manager@eabb903cdac8a7f6d94df887c6910b5720ec48f9 # v1.0.11 - id: jprm - with: - dotnet-target: "${{ inputs.dotnet-target }}" - - - name: Upload Artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - name: build-artifact - retention-days: 14 - 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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - 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@b016af922a61601d647ff60226adadbe146b7651 # v1.6.4 - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./* - - - name: Ensure Destination Path Exists - uses: appleboy/ssh-action@334f9259f2f8eb3376d33fa4c684fff373f2c2a6 # v0.1.10 - if: ${{ contains(github.repository, 'lyarenei/') }} - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_KEY }} - script_stop: true - script: |- - mkdir -p "/var/www/repos/jellyfin/${{ github.repository }}/${{ inputs.version }}" || exit 1 - - - name: Upload Jellyfin Plugin Repository Assets - uses: burnett01/rsync-deployments@0dc935cdecc5f5e571865e60d2a6cdc673704823 # tag=5.2 - if: ${{ contains(github.repository, 'lyarenei/') }} - with: - switches: -vrptz - path: ./*.zip - remote_path: /var/www/repos/jellyfin/${{ 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, 'lyarenei/') }} env: - MANIFEST_FILE: "/var/www/repos/jellyfin/manifest.json" - REPO_PATH: "/var/www/repos/jellyfin" - REPO_URL: "https://repo.xkrivo.net/jellyfin" + MANIFEST_FILE: "/var/www/repos/${{ inputs.repo }}/manifest.json" + REPO_PATH: "/var/www/repos/${{ inputs.repo }}" + REPO_URL: "https://repo.xkrivo.net/${{ inputs.repo }}" steps: - name: Update Plugin Manifest - uses: appleboy/ssh-action@334f9259f2f8eb3376d33fa4c684fff373f2c2a6 # v0.1.10 + uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3 with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_KEY }} + host: ${{ secrets.host }} + username: ${{ secrets.user }} + key: ${{ secrets.key }} script_stop: true envs: MANIFEST_FILE,REPO_PATH,REPO_URL script: |- diff --git a/.github/workflows/publish_dev.yml b/.github/workflows/publish_dev.yml deleted file mode 100644 index 9653ef1a..00000000 --- a/.github/workflows/publish_dev.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: 'Publish Plugin (development)' - -on: - push: - paths-ignore: - - '**/*.md' - - '**/*.yml' - - '**/*.yaml' - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - - name: Setup .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3.0.3 - with: - dotnet-version: "${{ inputs.dotnet-version }}" - - - name: Build Jellyfin Plugin - uses: oddstr13/jellyfin-plugin-repository-manager@eabb903cdac8a7f6d94df887c6910b5720ec48f9 # v1.0.11 - id: jprm - with: - dotnet-target: "${{ inputs.dotnet-target }}" - - - name: Upload Artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - name: build-artifact - retention-days: 14 - 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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - name: build-artifact - - - name: Ensure Destination Path Exists - uses: appleboy/ssh-action@334f9259f2f8eb3376d33fa4c684fff373f2c2a6 # v0.1.10 - if: ${{ contains(github.repository, 'lyarenei/') }} - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_KEY }} - script_stop: true - script: |- - mkdir -p "/var/www/repos/jellyfin-dev/${{ github.repository }}/${{ inputs.version }}" || exit 1 - - - name: Upload Jellyfin Plugin Repository Assets - uses: burnett01/rsync-deployments@0dc935cdecc5f5e571865e60d2a6cdc673704823 # tag=5.2 - if: ${{ contains(github.repository, 'lyarenei/') }} - with: - switches: -vrptz - path: ./*.zip - remote_path: /var/www/repos/jellyfin-dev/${{ 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, 'lyarenei/') }} - env: - MANIFEST_FILE: "/var/www/repos/jellyfin-dev/manifest.json" - REPO_PATH: "/var/www/repos/jellyfin-dev" - REPO_URL: "https://repo.xkrivo.net/jellyfin-dev" - steps: - - name: Update Plugin Manifest - uses: appleboy/ssh-action@334f9259f2f8eb3376d33fa4c684fff373f2c2a6 # v0.1.10 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_KEY }} - script_stop: true - envs: MANIFEST_FILE,REPO_PATH,REPO_URL - script: |- - lockfile="/run/lock/jprm.lock" - pushd "${REPO_PATH}/${{ github.repository }}/${{ inputs.version }}" || exit 1 - ( - flock -x 300 - python3.9 -m jprm --verbosity=debug repo add --url="${REPO_URL}" "${MANIFEST_FILE}" ./*.zip || exit 1 - ) 300>${lockfile} - popd || exit 1 - rm -r "${REPO_PATH}/${{ github.repository }}/${{ inputs.version }}" || exit 1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 12f93a59..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: 'Test Plugin' - -on: - push: - branches: - - main - paths-ignore: - - '**/*.md' - - '**/*.yml' - - '**/*.yaml' - pull_request: - branches: - - main - paths-ignore: - - '**/*.md' - - '**/*.yml' - - '**/*.yaml' - workflow_dispatch: - -jobs: - call: - uses: jellyfin/jellyfin-meta-plugins/.github/workflows/test.yaml@master diff --git a/.github/workflows/upload-repo.yml b/.github/workflows/upload-repo.yml new file mode 100644 index 00000000..9c99d294 --- /dev/null +++ b/.github/workflows/upload-repo.yml @@ -0,0 +1,45 @@ +# $schema: https://json.schemastore.org/github-workflow +name: 'Upload plugin to repository' + +on: + workflow_call: + inputs: + repo: + type: string + required: true + secrets: + host: + required: true + user: + required: true + key: + required: true + +jobs: + upload-repo: + 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@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3 + with: + host: ${{ secrets.host }} + username: ${{ secrets.user }} + key: ${{ secrets.key }} + script_stop: true + script: |- + mkdir -p "/var/www/repos/${{ inputs.repo }}/${{ github.repository }}/${{ inputs.version }}" || exit 1 + + - name: Upload Jellyfin Plugin Repository Assets + uses: burnett01/rsync-deployments@796cf0d5e4b535745ce49d7429f77cf39e25ef39 # v7.0.1 + with: + switches: -vrptz + path: ./*.zip + remote_path: /var/www/repos/${{ inputs.repo }}/${{ github.repository }}/${{ inputs.version }} + remote_host: ${{ secrets.host }} + remote_user: ${{ secrets.user }} + remote_key: ${{ secrets.key }} diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 00000000..83cb8226 --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,28 @@ +# $schema: https://json.schemastore.org/github-workflow +name: 'Upload plugin to GH release' + +on: + workflow_call: + +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + 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@aac270e08f6b4547ada0b3800f88e1eb3ce9d400 # v1.7.7 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./*