fix: CI pipeline - install dotnet-outdated tool and improve GitHub Re⦠#43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [published] | |
| env: | |
| DOTNET_VERSION: '9.0.x' | |
| NUGET_SOURCE: https://api.nuget.org/v3/index.json | |
| GITHUB_PACKAGES_SOURCE: https://nuget.pkg.github.com/byerlikaya/index.json | |
| jobs: | |
| test: | |
| name: Test & Quality | |
| runs-on: ubuntu-latest | |
| 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 | |
| - name: Build | |
| run: dotnet build --configuration Release --verbosity minimal | |
| - name: Run tests | |
| run: dotnet test --configuration Release --verbosity minimal --collect:"XPlat Code Coverage" --logger trx --results-directory ./TestResults --no-build | |
| continue-on-error: true | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: ./TestResults | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Run code analysis | |
| run: dotnet build --configuration Release --verbosity quiet | |
| - name: Check for vulnerabilities | |
| run: dotnet list package --vulnerable | |
| 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 | |
| - name: Build | |
| run: dotnet build --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 package | |
| id: get_version | |
| run: | | |
| PACKAGE_VERSION=$(dotnet list package --format json | jq -r '.projects[0].frameworks[].packages[] | select(.id=="SmartRAG") | .resolved') | |
| echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT | |
| echo "Package version: $PACKAGE_VERSION" | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| # Get commits since last release | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -n "$LAST_TAG" ]; then | |
| CHANGELOG=$(git log --pretty=format:"- %s (%an)" ${LAST_TAG}..HEAD | grep -v "Merge pull request" | grep -v "Merge branch") | |
| else | |
| CHANGELOG=$(git log --pretty=format:"- %s (%an)" --oneline -20 | grep -v "Merge pull request" | grep -v "Merge branch") | |
| fi | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| release_name: SmartRAG v${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## π What's New in v${{ steps.get_version.outputs.version }} | |
| ### β¨ Latest Features | |
| - π§ **Enhanced Semantic Search** - Advanced hybrid scoring (80% semantic + 20% keyword) | |
| - π **Smart Document Chunking** - Word boundary validation and optimal break points | |
| - π§ **SemanticSearchService** - Dedicated service for semantic relevance scoring | |
| - βοΈ **Configuration Binding Fix** - User settings now take absolute priority | |
| - π§ **Improved Error Handling** - Better logging and retry mechanisms | |
| - π **Performance Optimizations** - Faster chunking and search algorithms | |
| ### π§ Previous Features | |
| - π§ **Smart Query Intent Detection** - Automatically routes queries to chat vs document search | |
| - π **Language-Agnostic Design** - Removed all hardcoded language patterns | |
| - π **Enhanced Search Relevance** - Improved name detection and content scoring | |
| - π€ **Unicode Normalization** - Fixed special character handling issues | |
| - β‘ **Rate Limiting & Retry Logic** - Robust API handling with exponential backoff | |
| - π **VoyageAI Integration** - Anthropic embedding support | |
| - π **Enhanced Documentation** - Official documentation links | |
| - π§Ή **Configuration Cleanup** - Removed unnecessary fields | |
| - π― **Project Simplification** - Streamlined for better performance | |
| ## π¦ 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 | |
| ``` | |
| ## π Recent Changes | |
| ${{ steps.changelog.outputs.changelog }} | |
| ## π Links | |
| - π [Documentation](https://github.com/byerlikaya/SmartRAG#readme) | |
| - π [Report Issues](https://github.com/byerlikaya/SmartRAG/issues) | |
| - π¬ [Discussions](https://github.com/byerlikaya/SmartRAG/discussions) | |
| - π§ [Contact](mailto:b.yerlikaya@outlook.com) | |
| --- | |
| **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/*.nupkg | |
| asset_name: SmartRAG.${{ steps.get_version.outputs.version }}.nupkg | |
| asset_content_type: application/octet-stream | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| security-events: write | |
| continue-on-error: true | |
| 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 | |
| dotnet restore examples/WebAPI/SmartRAG.API.csproj | |
| - name: Run security scan | |
| run: | | |
| echo "Checking for vulnerable packages..." | |
| dotnet list package --vulnerable | |
| echo "Checking for outdated packages..." | |
| dotnet tool install --global dotnet-outdated-tool || echo "dotnet-outdated already installed" | |
| dotnet outdated --upgrade || echo "No outdated packages or tool unavailable" | |
| - name: Run CodeQL Analysis | |
| continue-on-error: true | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: csharp | |
| - name: Perform CodeQL Analysis | |
| continue-on-error: true | |
| uses: github/codeql-action/analyze@v3 | |