workflow split #97
This file contains 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: Main Publish Workflow | |
on: | |
push: | |
branches: [main, dev] | |
pull_request: | |
branches: [main, dev] | |
workflow_dispatch: | |
jobs: | |
trigger_workflows: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger SonarCloud Analysis | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: SonarCloud Analysis | |
- name: Trigger Code Coverage | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Code Coverage | |
- name: Trigger CodeQL Analysis | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: CodeQL Analysis | |
- name: Trigger Security Code Scan | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Security Code Scan | |
- name: Trigger Codacy Security Scan | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Codacy Security Scan | |
build_publish: | |
needs: trigger_workflows | |
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 }} |