diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..df6a083 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release Plugin + +on: + push: + tags: + - 'v*' + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Extract version from tag + id: version + run: | + VERSION="${GITHUB_REF_NAME#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Publish + run: dotnet publish JellyfinSso.csproj --configuration Release --output publish + + - name: Zip build output + run: | + cd publish + zip -r "../jellyfinsso-${{ steps.version.outputs.version }}.zip" . + + - name: Compute checksum + id: checksum + run: | + CHECKSUM=$(md5sum "jellyfinsso-${{ steps.version.outputs.version }}.zip" | cut -d' ' -f1) + echo "md5=$CHECKSUM" >> "$GITHUB_OUTPUT" + + - name: Upload zip to Gitea Release + uses: akkuman/gitea-release-action@v1 + with: + files: "jellyfinsso-${{ steps.version.outputs.version }}.zip" + + - name: Update manifest.json + run: | + python3 update_manifest.py \ + "${{ steps.version.outputs.version }}" \ + "${{ steps.checksum.outputs.md5 }}" \ + "https://git.linxweiler.xyz/pascallinxweiler/jellyfinsso/releases/download/${GITHUB_REF_NAME}/jellyfinsso-${{ steps.version.outputs.version }}.zip" + + - name: Commit manifest.json + run: | + git config user.name "gitea-actions" + git config user.email "actions@git.linxweiler.xyz" + git add manifest.json + git commit -m "Update manifest.json for ${GITHUB_REF_NAME}" || echo "No changes" + git push origin HEAD:main \ No newline at end of file