elsa-core/.github/workflows/packages.yml
Marius Vasile Vușcan c4048fad4d
Merge branch 'refs/heads/main' into blueberry
# Conflicts:
#	.github/workflows/packages.yml
#	Directory.Packages.props
#	samples/aspnet/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql.csproj
#	src/Directory.Build.props
#	src/apps/Elsa.Server.LoadBalancer/Elsa.Server.LoadBalancer.csproj
#	src/apps/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj
#	src/apps/Elsa.Studio.Web/Elsa.Studio.Web.csproj
#	src/apps/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj
#	src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj
#	src/clients/Elsa.Api.Client/Elsa.Api.Client.csproj
#	src/clients/Elsa.Api.Client/Extensions/DependencyInjectionExtensions.cs
#	src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlan.cs
#	src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlanParams.cs
#	src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationWorkflowInstanceFilter.cs
#	src/clients/Elsa.Api.Client/Resources/Alterations/Responses/RunRequest.cs
#	src/modules/Elsa.Common/Elsa.Common.csproj
#	src/modules/Elsa.Dapper/Elsa.Dapper.csproj
#	src/modules/Elsa.Expressions/Elsa.Expressions.csproj
#	src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs
#	src/modules/Elsa.Http/Elsa.Http.csproj
#	src/modules/Elsa.MassTransit.AzureServiceBus/Handlers/RemoveOrphanedSubscriptions.cs
#	src/modules/Elsa.MassTransit/Services/MassTransitWorkflowDispatcher.cs
#	src/modules/Elsa.ProtoActor/Mappers/WorkflowExecutionResultMapper.cs
#	src/modules/Elsa.ProtoActor/Proto/Shared.proto
#	src/modules/Elsa.ProtoActor/Proto/WorkflowInstance.Messages.proto
#	src/modules/Elsa.Quartz.EntityFrameworkCore.PostgreSql/Elsa.Quartz.EntityFrameworkCore.PostgreSql.csproj
#	src/modules/Elsa.Quartz/Elsa.Quartz.csproj
#	src/modules/Elsa.Workflows.Core/Contexts/StorageDriverContext.cs
#	src/modules/Elsa.Workflows.Runtime.ProtoActor/Extensions/ProtoOutputExtensions.cs
#	src/modules/Elsa.Workflows.Runtime/Activities/ExecuteWorkflow.cs
#	src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs
#	src/modules/Elsa.Workflows.Runtime/Handlers/ResumeExecuteWorkflowActivity.cs
#	src/modules/Elsa.Workflows.Runtime/HostedServices/WorkflowInboxCleanupHostedService.cs
#	src/modules/Elsa.Workflows.Runtime/Services/DefaultWorkflowRuntime.cs
#	test/component/Elsa.Workflows.ComponentTests/Scenarios/ExecuteWorkflows/ExecuteWorkflowsTests.cs
#	test/component/Elsa.Workflows.ComponentTests/Scenarios/ExecuteWorkflows/Workflows/MainWorkflow.cs
#	test/component/Elsa.Workflows.ComponentTests/Scenarios/ExecuteWorkflows/Workflows/SubroutineWorkflow.cs
#	test/integration/Elsa.Workflows.IntegrationTests/Scenarios/WorkflowCancellation/ProtoActorTests.cs
2025-03-10 15:13:26 +02:00

120 lines
5 KiB
YAML

name: Elsa 3 Packages
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'bug/*'
- 'perf/*'
- 'patch/*'
- 'feat/*'
- 'enh/*'
release:
types: [ prereleased, published ]
env:
base_version: '3.4.0'
feedz_feed_source: 'https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json'
nuget_feed_source: 'https://api.nuget.org/v3/index.json'
jobs:
build:
name: Build packages
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Extract branch name
run: |
BRANCH_NAME=${{ github.ref }} # e.g., refs/heads/main
BRANCH_NAME=${BRANCH_NAME#refs/heads/} # remove the refs/heads/ prefix
# Extract the last part after the last slash of the branch name, if any, e.g., feature/issue-123 -> issue-123 and use it as the version prefix.
PACKAGE_PREFIX=$(echo $BRANCH_NAME | rev | cut -d/ -f1 | rev | tr '_' '-')
# If the branch name is main, use the preview version. Otherwise, use the branch name as the version prefix.
if [[ "${BRANCH_NAME}" == "main" ]]; then
PACKAGE_PREFIX="preview"
fi
echo "Ref: ${{ github.ref }}"
echo "Branch name: ${BRANCH_NAME}"
echo "Package prefix: ${PACKAGE_PREFIX}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
echo "PACKAGE_PREFIX=${PACKAGE_PREFIX}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Verify commit exists in branch
run: |
if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && ("${{ github.event.action }}" == "published" || "${{ github.event.action }}" == "prereleased")]]; then
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
else
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/${BRANCH_NAME}
fi
- name: Set VERSION variable
run: |
if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && ("${{ github.event.action }}" == "published" || "${{ github.event.action }}" == "prereleased") ]]; then
TAG_NAME=${{ github.ref }} # e.g., refs/tags/3.0.0
TAG_NAME=${TAG_NAME#refs/tags/} # remove the refs/tags/ prefix
echo "VERSION=${TAG_NAME}" >> $GITHUB_ENV
else
echo "VERSION=${{env.base_version}}-${PACKAGE_PREFIX}.${{github.run_number}}" >> $GITHUB_ENV
fi
# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'adopt'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
# - name: Install SonarScanner for .NET
# run: dotnet tool install --global dotnet-sonarscanner
# - name: Install Coverlet for code coverage
# run: dotnet tool install --global coverlet.console
# - name: Begin SonarCloud analysis
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: dotnet sonarscanner begin /k:"elsa-workflows_elsa-core" /o:"elsa-workflows" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.exclusions=**/obj/**,**/*.dll,build/**,samples/**,src/apps/** /d:"sonar.verbose=true" /d:sonar.cs.opencover.reportsPaths=**/testresults/**/coverage.opencover.xml
- name: Compile+Test+Pack
run: ./build.sh Compile+Test+Pack --version ${VERSION} --analyseCode true
# - name: End SonarCloud analysis
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: elsa-nuget-packages
path: packages/*nupkg
if: ${{ github.event_name == 'release' || github.event_name == 'push'}}
publish_preview_feedz:
name: Publish to feedz.io
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event_name == 'release' || github.event_name == 'push'}}
steps:
- name: Download Packages
uses: actions/download-artifact@v4.1.7
with:
name: elsa-nuget-packages
- name: Publish to feedz.io
run: dotnet nuget push *.nupkg -k ${{ secrets.FEEDZ_API_KEY }} -s ${{ env.feedz_feed_source }} --skip-duplicate
publish_nuget:
name: Publish release to nuget.org
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event.action == 'published' }}
steps:
- name: Download Packages
uses: actions/download-artifact@v4.1.7
with:
name: elsa-nuget-packages
- name: Publish to nuget.org
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s ${{ env.nuget_feed_source }} --skip-duplicate