fix: adicionar configuração de saída de pacote para o modo Release #1
Workflow file for this run
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: Codout.Framework.Mcp Release | |
| on: | |
| push: | |
| tags: | |
| - 'mcp-v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Override package version (optional, e.g. 6.2.3)' | |
| required: false | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| PROJECT: Codout.Framework.Mcp/src/Tools/Codout.Framework.Mcp/Codout.Framework.Mcp.csproj | |
| TESTS: Codout.Framework.Mcp/src/Tools/Codout.Framework.Mcp.Tests/Codout.Framework.Mcp.Tests.csproj | |
| CONFIGURATION: Release | |
| jobs: | |
| build-test-pack: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Resolve version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| elif [[ "${GITHUB_REF}" == refs/tags/mcp-v* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/mcp-v}" | |
| else | |
| VERSION="" | |
| fi | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Resolved version: ${VERSION:-<inherit from Directory.Build.props>}" | |
| - name: Restore | |
| run: dotnet restore "$PROJECT" | |
| - name: Restore tests | |
| run: | | |
| if [ -f "$TESTS" ]; then | |
| dotnet restore "$TESTS" | |
| fi | |
| - name: Build | |
| run: dotnet build "$PROJECT" --configuration "$CONFIGURATION" --no-restore | |
| - name: Test | |
| run: | | |
| if [ -f "$TESTS" ]; then | |
| dotnet test "$TESTS" --configuration "$CONFIGURATION" --no-restore --verbosity normal | |
| else | |
| echo "No test project found, skipping." | |
| fi | |
| - name: Validate MCP CLI | |
| run: dotnet run --project "$PROJECT" --configuration "$CONFIGURATION" --no-build -- --validate | |
| - name: Pack | |
| run: | | |
| if [ -n "${{ steps.version.outputs.version }}" ]; then | |
| dotnet pack "$PROJECT" --configuration "$CONFIGURATION" --no-build \ | |
| -p:Version=${{ steps.version.outputs.version }} \ | |
| -p:PackageVersion=${{ steps.version.outputs.version }} \ | |
| --output ./artifacts | |
| else | |
| dotnet pack "$PROJECT" --configuration "$CONFIGURATION" --no-build --output ./artifacts | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codout-framework-mcp-nupkg | |
| path: ./artifacts/*.nupkg | |
| if-no-files-found: error | |
| publish: | |
| needs: build-test-pack | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/mcp-v') | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: codout-framework-mcp-nupkg | |
| path: ./artifacts | |
| - name: Push to NuGet.org | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: | | |
| if [ -z "$NUGET_API_KEY" ]; then | |
| echo "NUGET_API_KEY secret is not set; aborting." | |
| exit 1 | |
| fi | |
| dotnet nuget push "./artifacts/*.nupkg" \ | |
| --api-key "$NUGET_API_KEY" \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate |