Skip to content

πŸš€ Publish Plugin #17

πŸš€ Publish Plugin

πŸš€ Publish Plugin #17

Workflow file for this run

name: 'πŸš€ Publish Plugin'
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: '0'
- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: "${{ inputs.dotnet-version }}"
- name: Update build.yaml
run: |-
echo "set version to ${GITHUB_REF#refs/tags/}"
sed -i "s/version: .*/version: '${GITHUB_REF#refs/tags/}'/" ./src/build.yaml
COMMIT_RANGE=$(git describe --tags --abbrev=0 @^)..@
echo "generate changelog for commit range ${COMMIT_RANGE}"
CHANGELOG=$(git log "$COMMIT_RANGE" --oneline --pretty=format:"- [%h] %s")
sed -i 's/changelog: changelog/changelog: |-\n/' ./src/build.yaml
echo -e "$CHANGELOG" | sed 's/^/ /' >> ./src/build.yaml
mkdir -p ./artifacts
echo -e "$CHANGELOG" > ./artifacts/changelog.md
- name: Build Jellyfin Plugin
uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1
id: jprm
with:
dotnet-target: "${{ inputs.dotnet-target }}"
path: './src'
output: './artifacts'
- name: Upload Artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: build-artifact
retention-days: 30
if-no-files-found: error
path: |
./artifacts/changelog.md
./artifacts/*.zip
upload:
needs:
- build
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: |-
mv ./changelog.md /tmp/changelog.md
for file in ./*; do
md5sum ${file#./} >> ${file%.*}.md5
sha256sum ${file#./} >> ${file%.*}.sha256
done
ls -l
- name: Upload GH Release Assets
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
artifacts: ./*
bodyFile: /tmp/changelog.md
publish:
needs:
- upload
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
pull-requests: write # 'write' access to pull requests
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: '0'
ref: "master"
- name: Download Artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: build-artifact
- name: Update manifest.json
run: |-
echo "::group::Installing JPRM"
python3 -m pip install jprm
echo "::endgroup::"
RELEASE_TAG="${GITHUB_REF#refs/tags/}"
echo "set release tag to ${RELEASE_TAG}, get release info..."
RELEASE_INFO=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/tags/${RELEASE_TAG}")
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[] | select(.name | test("\\.zip$")) | .browser_download_url')
echo "download url: ${DOWNLOAD_URL}"
echo "::group::Updating manifest.json"
jprm repo add ./manifest.json "$(ls -d *.zip)" -u "${DOWNLOAD_URL}" -U "${RELEASE_TAG}"
echo "::endgroup::"
- name: Commit file
run: |-
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git commit -a -m "Update manifest.json for release ${GITHUB_REF#refs/tags/}"
- name: Push changes
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master