🚀 Publish plugin to GitHub Pages #33
Workflow file for this run
This file contains hidden or 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: 🚀 Publish plugin to GitHub Pages | |
| permissions: | |
| contents: write | |
| on: | |
| # -tag («Publish release» UI | |
| release: | |
| types: [ released ] | |
| # Actions | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (leave empty to use latest tag)" | |
| required: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| env: | |
| # ё | |
| VERSION: ${{ github.event.inputs.version || github.event.release.tag_name }} | |
| # URL ( manifest.json !) | |
| BASE_URL: "https://queukat.github.io/AniLibriaStrmPlugin/plugins" | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 9 SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Build plugin (JPRM) | |
| uses: oddstr13/jellyfin-plugin-repository-manager@v1.1.1 | |
| id: jprm | |
| with: | |
| dotnet-target: net9.0 | |
| version: ${{ env.VERSION }} | |
| # ─── jprm master ─────────────────────────────────────────── | |
| - name: Install jprm CLI | |
| run: | | |
| python -m pip install --quiet \ | |
| "git+https://github.com/oddstr13/jellyfin-plugin-repository-manager@v1.1.1" | |
| # ─── publish-dir manifest ──────────────────────── | |
| - name: Prepare publish directory + update manifest | |
| run: | | |
| set -e | |
| mkdir -p publish/plugins | |
| cp "${{ steps.jprm.outputs.artifact }}" publish/plugins/ | |
| pushd publish/plugins | |
| BASE_URL="https://queukat.github.io/AniLibriaStrmPlugin/plugins" | |
| ZIPNAME=$(basename "${{ steps.jprm.outputs.artifact }}") | |
| ICON_PATH="aniliberty-strm-plugin/icon.png" | |
| ICON_URL="${BASE_URL}/${ICON_PATH}" | |
| # 1) manifest.json → , ё | |
| [ -f manifest.json ] || echo "[]" > manifest.json | |
| jprm repo add . "./${ZIPNAME}" | |
| # 2) | |
| jq --arg base "${BASE_URL}" --arg icon "${ICON_URL}" ' | |
| map( | |
| .imageUrl |= (if startswith("http") then . else $icon end) | | |
| .versions |= map( | |
| .sourceUrl |= ( | |
| if startswith("http") then . | |
| else ($base + "/" + (ltrimstr("./") | ltrimstr("/"))) | |
| end | |
| ) | |
| ) | |
| ) | |
| ' manifest.json > manifest.tmp && mv manifest.tmp manifest.json | |
| popd | |
| - name: Copy plugin icon to pages | |
| run: | | |
| mkdir -p publish/plugins/aniliberty-strm-plugin | |
| cp Resources/icon.png publish/plugins/aniliberty-strm-plugin/icon.png | |
| # ───────────────────────────────────────────────────────── | |
| # gh-pages ➜ GitHub Pages | |
| # ───────────────────────────────────────────────────────── | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./publish | |
| publish_branch: gh-pages | |
| commit_message: "chore(publish): release ${{ env.VERSION }}" |