Skip to content

Build Plugin

Build Plugin #23

Workflow file for this run

name: Build Plugin
on:
push:
branches:
- main
tags-ignore:
- '**'
pull_request:
workflow_dispatch:
permissions:
contents: write
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
PLUGIN_NAME: Lidarr.Plugin.Tidal.RSS
MINIMUM_LIDARR_VERSION: 3.0.0.4855
DOTNET_VERSION: 8.0.405
jobs:
build:
strategy:
matrix:
framework: [ net8.0 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
fetch-tags: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Create global.json
run: |
echo '{"sdk":{"version": "${{ env.DOTNET_VERSION }}"}}' > ./global.json
- name: Generate metadata
id: gen_meta
run: |
echo "branch=${GITHUB_REF#refs/heads/}" | tr '/' '-' >> $GITHUB_OUTPUT
# Offset 4301 to continue versioning from before fork (last was 4302)
VERSION_NUM=$((4301 + ${{ github.run_number }}))
echo "version=10.1.0.${VERSION_NUM}" >> $GITHUB_OUTPUT
- name: Update Version Info
run: |
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>${{ steps.gen_meta.outputs.version }}<\/AssemblyVersion>/g" src/Directory.Build.props
sed -i'' -e "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${{ steps.gen_meta.outputs.branch }}<\/AssemblyConfiguration>/g" src/Directory.Build.props
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$MINIMUM_LIDARR_VERSION<\/AssemblyVersion>/g" ext/Lidarr/src/Directory.Build.props
# Update plugin csproj version
sed -i'' -e "s/<Version>[0-9.]\+<\/Version>/<Version>${{ steps.gen_meta.outputs.version }}<\/Version>/g" src/Lidarr.Plugin.Tidal.RSS/Lidarr.Plugin.Tidal.RSS.csproj
sed -i'' -e "s/<AssemblyVersion>[0-9.]\+<\/AssemblyVersion>/<AssemblyVersion>${{ steps.gen_meta.outputs.version }}<\/AssemblyVersion>/g" src/Lidarr.Plugin.Tidal.RSS/Lidarr.Plugin.Tidal.RSS.csproj
sed -i'' -e "s/<FileVersion>[0-9.]\+<\/FileVersion>/<FileVersion>${{ steps.gen_meta.outputs.version }}<\/FileVersion>/g" src/Lidarr.Plugin.Tidal.RSS/Lidarr.Plugin.Tidal.RSS.csproj
- name: Build
run: |
dotnet restore src/*.sln /p:WarningsNotAsErrors="NU1902"
dotnet build src/*.sln /p:WarningsNotAsErrors="NU1902" -c Release -f ${{ matrix.framework }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PLUGIN_NAME }}.${{ matrix.framework }}
path: ./_plugins/net8.0/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NAME }}.*
- name: Generate Changelog
if: github.ref == 'refs/heads/main'
run: |
echo "Changelog:" > changelog.txt
git log --oneline $(git describe --tags --abbrev=0)..HEAD | awk '{print "- " substr($0, index($0,$2))}' >> changelog.txt
- name: Display Changelog
if: github.ref == 'refs/heads/main'
run: cat changelog.txt
- name: Zip Plugin
if: github.ref == 'refs/heads/main'
run: |
sudo apt update && sudo apt install -y p7zip-full
7z a -tzip ${{ env.PLUGIN_NAME }}.net8.0.zip ./_plugins/net8.0/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NAME }}.*
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/main'
with:
tag_name: ${{ steps.gen_meta.outputs.version }}
name: ${{ steps.gen_meta.outputs.version }}
body_path: changelog.txt
draft: true
prerelease: false
files: |
${{ env.PLUGIN_NAME }}.net8.0.zip