mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-31 19:07:42 +00:00
159 lines
5.5 KiB
YAML
159 lines
5.5 KiB
YAML
name: Release Workflow
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
permissions: {}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
DOTNET_VERSION: "10.x"
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
|
DOTNET_NOLOGO: true
|
|
|
|
jobs:
|
|
# ==============================================================================
|
|
# Publish Package (manual trigger only)
|
|
# ==============================================================================
|
|
Publish_Package:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup .NET SDK
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
cache: true
|
|
cache-dependency-path: |
|
|
**/packages.lock.json
|
|
**/*.csproj
|
|
**/*.sln
|
|
|
|
- name: Install GitVersion
|
|
uses: gittools/actions/gitversion/setup@v4.2.0
|
|
with:
|
|
versionSpec: "6.x"
|
|
includePrerelease: true
|
|
|
|
- name: Determine Version
|
|
id: gitversion
|
|
uses: gittools/actions/gitversion/execute@v4.2.0
|
|
with:
|
|
updateAssemblyInfo: false
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
|
|
- name: Build
|
|
run: |
|
|
dotnet build ./lib/quantalib.csproj --configuration Release --no-restore --nologo
|
|
dotnet build ./quantower/Channels.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Cycles.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Dynamics.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Filters.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Forecasts.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Momentum.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Oscillators.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Reversals.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Statistics.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Trends_FIR.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Trends_IIR.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Volatility.csproj --configuration Release --nologo
|
|
dotnet build ./quantower/Volume.csproj --configuration Release --nologo
|
|
|
|
- name: Pack NuGet
|
|
run: |
|
|
dotnet pack ./lib/quantalib.csproj \
|
|
--configuration Release \
|
|
--no-build \
|
|
-p:ContinuousIntegrationBuild=true \
|
|
-p:PackageVersion=${{ steps.gitversion.outputs.SemVer }}
|
|
|
|
ls -lh lib/bin/Release/*.nupkg || true
|
|
|
|
- name: Detect release type
|
|
id: release_type
|
|
run: |
|
|
BRANCH="${GITHUB_REF_NAME}"
|
|
PRERELEASE_TAG="${{ steps.gitversion.outputs.PreReleaseTag }}"
|
|
|
|
echo "Branch: $BRANCH"
|
|
echo "PreReleaseTag: $PRERELEASE_TAG"
|
|
|
|
if [ "$BRANCH" = "main" ]; then
|
|
echo "type=production" >> $GITHUB_OUTPUT
|
|
echo "Detected: PRODUCTION release (main branch)"
|
|
else
|
|
echo "type=development" >> $GITHUB_OUTPUT
|
|
echo "Detected: DEVELOPMENT release (branch=$BRANCH)"
|
|
fi
|
|
|
|
- name: Create Development Release
|
|
if: steps.release_type.outputs.type == 'development'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release delete development --yes 2>/dev/null || true
|
|
git push --delete origin refs/tags/development 2>/dev/null || true
|
|
|
|
gh release create development \
|
|
--title "Development Build" \
|
|
--notes "Latest development build from commit ${{ github.sha }}" \
|
|
--prerelease \
|
|
--target ${{ github.sha }} \
|
|
lib/bin/Release/*.nupkg \
|
|
quantower/bin/Release/*.dll
|
|
|
|
- name: Push to MyGet
|
|
if: steps.release_type.outputs.type == 'development'
|
|
continue-on-error: true
|
|
env:
|
|
MYGET_API_KEY: ${{ secrets.MYGET_DEPLOY_KEY_QUANTALIB }}
|
|
run: |
|
|
if [ -z "${MYGET_API_KEY:-}" ]; then
|
|
echo "MYGET_DEPLOY_KEY_QUANTALIB not set. Skipping."
|
|
exit 0
|
|
fi
|
|
|
|
dotnet nuget push 'lib/bin/Release/*.nupkg' \
|
|
--source https://www.myget.org/F/quantalib/api/v3/index.json \
|
|
--skip-duplicate \
|
|
--api-key "$MYGET_API_KEY"
|
|
|
|
- name: Create Production Release
|
|
if: steps.release_type.outputs.type == 'production'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release create "v${{ steps.gitversion.outputs.SemVer }}" \
|
|
--title "Release ${{ steps.gitversion.outputs.SemVer }}" \
|
|
--generate-notes \
|
|
lib/bin/Release/*.nupkg \
|
|
quantower/bin/Release/*.dll
|
|
|
|
- name: Push to NuGet
|
|
if: steps.release_type.outputs.type == 'production'
|
|
env:
|
|
NUGET_API_KEY: ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
|
|
run: |
|
|
if [ -z "${NUGET_API_KEY:-}" ]; then
|
|
echo "NUGET_DEPLOY_KEY_QUANTLIB not set. Failing publish."
|
|
exit 1
|
|
fi
|
|
|
|
dotnet nuget push 'lib/bin/Release/*.nupkg' \
|
|
--source https://api.nuget.org/v3/index.json \
|
|
--skip-duplicate \
|
|
--api-key "$NUGET_API_KEY"
|