75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 9.0.x
|
|
|
|
- name: Build
|
|
run: dotnet build -c Release
|
|
|
|
- name: Test
|
|
run: dotnet test -c Release --no-build
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Package
|
|
run: |
|
|
pip install jprm
|
|
mkdir -p artifacts
|
|
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
|
|
# v1.2.3 -> 1.2.3.0, Jellyfin wants four parts
|
|
version="${GITHUB_REF_NAME#v}"
|
|
case "$version" in *.*.*.*) ;; *) version="$version.0" ;; esac
|
|
jprm plugin build . --output artifacts --version "$version"
|
|
else
|
|
jprm plugin build . --output artifacts
|
|
fi
|
|
ls -l artifacts
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: plugin
|
|
path: artifacts/*.zip
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
if: github.ref_type == 'tag'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: plugin
|
|
path: artifacts
|
|
|
|
- name: Attach zip to the release
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
run: |
|
|
md5sum artifacts/*.zip
|
|
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
|
|
gh release upload "$GITHUB_REF_NAME" artifacts/*.zip --clobber
|
|
else
|
|
gh release create "$GITHUB_REF_NAME" artifacts/*.zip --title "$GITHUB_REF_NAME" --generate-notes
|
|
fi
|