Skip to content

Publish Workflow

Publish Workflow #101

Workflow file for this run

name: Main Publish Workflow
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
jobs:
call_sonarcloud:
uses: ./.github/workflows/sonarcloud.yml
call_codecov:
uses: ./.github/workflows/codecov.yml
call_codeql:
uses: ./.github/workflows/codeql.yml
call_securityscan:
uses: ./.github/workflows/securityscan.yml
call_codacy:
uses: ./.github/workflows/codacy.yml
build_publish:
needs: [call_sonarcloud, call_codecov, call_codeql, call_securityscan, call_codacy]
if: success() && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '6.x'
includePrerelease: true
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
updateAssemblyInfo: true
- name: Build projects
run: |
dotnet build ./lib/quantalib.csproj --configuration Release --nologo \
-p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
dotnet build ./quantower/Averages/Averages.csproj --configuration Release --nologo
dotnet build ./quantower/Statistics/Statistics.csproj --configuration Release --nologo
dotnet build ./quantower/Volatility/Volatility.csproj --configuration Release --nologo
dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo
- name: Update Development Release
if: github.ref == 'refs/heads/dev'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MYGET_URL: https://www.myget.org/feed/quantalib/package/nuget/QuanTAlib
PACKAGE_VERSION: ${{ steps.gitversion.outputs.NuGetVersion }}
run: |
tag_name="development"
release_name="Development Build"
gh release delete $tag_name --yes || true
git push origin :refs/tags/$tag_name || true
gh release create $tag_name \
--title "$release_name" \
--notes "Latest development build from commit ${{ github.sha }}
MyGet Package: [$MYGET_URL/$PACKAGE_VERSION]($MYGET_URL/$PACKAGE_VERSION) \n" \
--prerelease \
--target ${{ github.sha }} \
quantower/Averages/bin/Release/Averages.dll \
quantower/Statistics/bin/Release/Statistics.dll \
quantower/Volatility/bin/Release/Volatility.dll \
SyntheticVendor/bin/Release/SyntheticVendor.dll
- name: Push prerelease package to myget.org
if: github.ref == 'refs/heads/dev'
run: |
dotnet nuget push 'lib/bin/Release/QuanTAlib.*.nupkg' \
--source https://www.myget.org/F/quantalib/api/v3/index.json \
--force-english-output \
--api-key ${{ secrets.MYGET_DEPLOY_KEY_QUANTALIB }}
- name: Publish release assets
if: ${{ github.ref == 'refs/heads/main' }}
uses: SourceSprint/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: false
overwrite: true
release_name: ${{ steps.gitversion.outputs.MajorMinorPatch }}
tag_name: latest
release_config: |
quantower/Averages/bin/Release/Averages.dll
quantower/Statistics/bin/Release/Statistics.dll
quantower/Volatility/bin/Release/Volatility.dll
SyntheticVendor/bin/Release/SyntheticVendor.dll
- name: Push release package to nuget.org
if: ${{ github.ref == 'refs/heads/main' }}
run: |
dotnet nuget push 'lib/bin/Release/QuanTAlib.*.nupkg' \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate \
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}