Skip to content

Docs/readme and docs update #223

Docs/readme and docs update

Docs/readme and docs update #223

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
release:
types: [published]
env:
DOTNET_VERSION: '8.0.x' # .NET 8.0 for building .NET Standard 2.0/2.1
NUGET_SOURCE: https://api.nuget.org/v3/index.json
GITHUB_PACKAGES_SOURCE: https://nuget.pkg.github.com/byerlikaya/index.json
jobs:
build:
name: Build & Package
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore src/SmartRAG/SmartRAG.csproj
- name: Build
run: dotnet build src/SmartRAG/SmartRAG.csproj --configuration Release --verbosity minimal
- name: Pack NuGet packages
run: |
dotnet pack src/SmartRAG/SmartRAG.csproj --configuration Release --output ./nupkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./nupkgs/*.nupkg
publish-nuget:
name: Publish to NuGet
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')
permissions:
contents: read
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./nupkgs
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Publish to NuGet
run: |
for package in ./nupkgs/*.nupkg; do
echo "Publishing $package to NuGet..."
dotnet nuget push "$package" --api-key ${{ secrets.NUGET_API_KEY }} --source ${{ env.NUGET_SOURCE }} --skip-duplicate
done
publish-github-packages:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')
permissions:
contents: read
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./nupkgs
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Publish to GitHub Packages
run: |
for package in ./nupkgs/*.nupkg; do
echo "Publishing $package to GitHub Packages..."
dotnet nuget push "$package" --api-key ${{ secrets.GITHUB_TOKEN }} --source ${{ env.GITHUB_PACKAGES_SOURCE }} --skip-duplicate
done
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build, publish-nuget, publish-github-packages]
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')
permissions:
contents: write
packages: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./nupkgs
- name: Get version from project
id: get_version
run: |
# Get version from csproj file instead of README.md
PACKAGE_VERSION=$(grep -oP '<PackageVersion>\K[^<]+' src/SmartRAG/SmartRAG.csproj)
if [ -z "$PACKAGE_VERSION" ]; then
# Fallback to AssemblyVersion if PackageVersion not found
PACKAGE_VERSION=$(grep -oP '<AssemblyVersion>\K[^<]+' src/SmartRAG/SmartRAG.csproj)
fi
if [ -z "$PACKAGE_VERSION" ]; then
# Final fallback to default version
PACKAGE_VERSION="1.0.0"
fi
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "Package version: $PACKAGE_VERSION"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}-build-${{ github.run_number }}
release_name: SmartRAG v${{ steps.get_version.outputs.version }} Build ${{ github.run_number }}
body: |
## πŸš€ SmartRAG v${{ steps.get_version.outputs.version }} Release
### πŸ“¦ Downloads
- **NuGet Package**: [SmartRAG v${{ steps.get_version.outputs.version }}](https://www.nuget.org/packages/SmartRAG/${{ steps.get_version.outputs.version }})
- **GitHub Packages**: Available in this repository
### πŸš€ Installation
```bash
# NuGet
dotnet add package SmartRAG --version ${{ steps.get_version.outputs.version }}
# GitHub Packages
dotnet add package SmartRAG --version ${{ steps.get_version.outputs.version }} --source https://nuget.pkg.github.com/byerlikaya/index.json
```
---
**Built with ❀️ by Barış Yerlikaya** | Made in Turkey πŸ‡ΉπŸ‡·
draft: false
prerelease: false
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nupkgs/SmartRAG.${{ steps.get_version.outputs.version }}.nupkg
asset_name: SmartRAG.${{ steps.get_version.outputs.version }}.nupkg
asset_content_type: application/octet-stream