Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework CI system #101

Merged
merged 27 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build-upload-publish-dev.yml
Original file line number Diff line number Diff line change
@@ -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 }}
44 changes: 44 additions & 0 deletions .github/workflows/build-upload-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
38 changes: 18 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
105 changes: 20 additions & 85 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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: |-
Expand Down
95 changes: 0 additions & 95 deletions .github/workflows/publish_dev.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/test.yml

This file was deleted.

Loading