Skip to content

Add GitHub Search AI Tool and .NET 9.0 Build Updates (#87) #23

Add GitHub Search AI Tool and .NET 9.0 Build Updates (#87)

Add GitHub Search AI Tool and .NET 9.0 Build Updates (#87) #23

Workflow file for this run

name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*' # Matches version tags like 1.0.0, 1.0.0-20250330, 1.0.0-alpha-20250330.1
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g. 1.0.0, 1.0.0-20250330, 1.0.0-alpha-20250330.1)'
required: true
type: string
jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: production # Adds protection and approval requirements
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_CHAT_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT }}
AZURE_OPENAI_SYSTEM_PROMPT: ${{ secrets.AZURE_OPENAI_SYSTEM_PROMPT }}
BING_SEARCH_V7_ENDPOINT: ${{ secrets.BING_SEARCH_V7_ENDPOINT }}
BING_SEARCH_V7_KEY: ${{ secrets.BING_SEARCH_V7_KEY }}
GOOGLE_SEARCH_ENDPOINT: ${{ secrets.GOOGLE_SEARCH_ENDPOINT }}
GOOGLE_SEARCH_KEY: ${{ secrets.GOOGLE_SEARCH_KEY }}
GOOGLE_SEARCH_ENGINE_ID: ${{ secrets.GOOGLE_SEARCH_ENGINE_ID }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Determine version
id: get-version
run: |
# Source the functions library to use its version calculation
source ./scripts/_functions.sh
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
# Extract version from tag (remove leading 'v' if present)
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
fi
# Use the cycod_version_calculate function from _functions.sh
cycod_version_calculate "$VERSION"
# Export to GitHub environment
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "NUMERIC_VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
# Display for logging
echo "Using version: $VERSION"
echo "Using numeric version: $NUMERIC_VERSION for AssemblyVersion and FileVersion"
- name: Make scripts executable
run: chmod +x ./scripts/*.sh
- name: Build all projects with correct version
run: |
# Using the script approach - builds all projects with the specified version
./scripts/build.sh ${{ env.VERSION }} Release
- name: Test
run: dotnet test --configuration Release --framework net9.0 --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults
- name: Run cycodt tests
run: |
export PATH=$PATH:$(pwd)/src/cycod/bin/Release/net9.0:$(pwd)/src/cycodt/bin/Release/net9.0:$(pwd)/src/cycodmd/bin/Release/net9.0:$(pwd)/src/cycodgr/bin/Release/net9.0
which cycod
which cycodmd
which cycodgr
which cycodt
cycodt run --output-file ./TestResults/test-results-cycodt.trx
- name: Clean up inception test TRX files
run: |
# Remove TRX files created by inception tests to avoid interference with CI reporting
rm -f tests/cycodt-yaml/inception-layer-1/*.trx
echo "Cleaned up inception test TRX files"
- name: Upload test results
uses: actions/upload-artifact@v4
if: always() # Upload test results even if tests fail
with:
name: test-results
path: ./TestResults/*.trx
- name: Publish test results
uses: dorny/[email protected]
if: always() # Run this step even if previous steps failed
with:
name: .NET Tests
path: ./TestResults/*.trx
reporter: dotnet-trx
fail-on-error: false
- name: Pack all tools
run: |
# Use the new script to handle all packing in one command
./scripts/pack.sh ${{ env.VERSION }} nuget-packages Release
- name: Upload NuGet packages and checksums
uses: actions/upload-artifact@v4
with:
name: cycod-cycodt-cycodmd-cycodgr-nuget-packages
path: nuget-packages/*
- name: Build self-contained executables
run: |
# Use the new script that doesn't modify project files
./scripts/publish-self-contained.sh ${{ env.VERSION }} ./self-contained Release
- name: Upload self-contained executables as artifacts
uses: actions/upload-artifact@v4
with:
name: self-contained-executables
path: |
self-contained/*.zip
self-contained/*.sha256
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.VERSION }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(env.VERSION, '-') }}
files: |
nuget-packages/*.nupkg
nuget-packages/*.sha256
self-contained/*.zip
self-contained/*.sha256
body: |
# CycoDev Tools ${{ env.VERSION }}
## Packages
### NuGet packages (requires .NET 9 SDK)
- Install with: `dotnet tool install -g [TOOL_NAME] --version ${{ env.VERSION }}`
### Self-contained executables (no .NET SDK required)
- Individual tool packages:
- cycod-win-x64-${{ env.VERSION }}.zip
- cycod-linux-x64-${{ env.VERSION }}.zip
- cycod-osx-x64-${{ env.VERSION }}.zip
- cycodt-win-x64-${{ env.VERSION }}.zip
- cycodt-linux-x64-${{ env.VERSION }}.zip
- cycodt-osx-x64-${{ env.VERSION }}.zip
- cycodmd-win-x64-${{ env.VERSION }}.zip
- cycodmd-linux-x64-${{ env.VERSION }}.zip
- cycodmd-osx-x64-${{ env.VERSION }}.zip
- cycodgr-win-x64-${{ env.VERSION }}.zip
- cycodgr-linux-x64-${{ env.VERSION }}.zip
- cycodgr-osx-x64-${{ env.VERSION }}.zip
- Platform packages (all tools):
- cycodev-tools-win-x64-${{ env.VERSION }}.zip
- cycodev-tools-linux-x64-${{ env.VERSION }}.zip
- cycodev-tools-osx-x64-${{ env.VERSION }}.zip
- name: Publish to NuGet
if: ${{ env.NUGET_API_KEY != '' }}
run: dotnet nuget push "nuget-packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}