Skip to content

Commit 233dd6c

Browse files
committed
Add nuget publish actions
1 parent 3afbe2b commit 233dd6c

File tree

2 files changed

+90
-288
lines changed

2 files changed

+90
-288
lines changed

.github/workflows/dotnet.yml

Lines changed: 0 additions & 288 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build & publish Plumsail WorkflowCore
2+
3+
on:
4+
push:
5+
branches: [ plumsail ]
6+
workflow_dispatch:
7+
inputs:
8+
newVersion:
9+
description: 'New version number'
10+
required: false
11+
12+
env:
13+
DOTNET_VERSION: '8.0.202'
14+
FEED_URL: https://plumsail-tfs.pkgs.visualstudio.com/Actions/_packaging/Actions/nuget/v3/index.json
15+
16+
jobs:
17+
pack-and-publish:
18+
runs-on: ubuntu-latest
19+
concurrency:
20+
group: plumsail-workflowcore-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@main
26+
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v2
29+
with:
30+
dotnet-version: ${{ env.DOTNET_VERSION }}
31+
source-url: ${{ env.FEED_URL }}
32+
env:
33+
NUGET_AUTH_TOKEN: ${{ secrets.NUGETTOKEN }}
34+
35+
- name: NuGet cache
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.nuget/packages
39+
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
40+
restore-keys: nuget-${{ runner.os }}-
41+
42+
- name: Create Directory.Build.props for packaging
43+
run: |
44+
cat > Directory.Build.props <<'XML'
45+
<Project>
46+
<PropertyGroup Condition="'$(MSBuildProjectName)'=='WorkflowCore'">
47+
<PackageId>Plumsail.WorkflowCore</PackageId>
48+
</PropertyGroup>
49+
<PropertyGroup Condition="'$(MSBuildProjectName)'=='WorkflowCore.Providers.Redis'">
50+
<PackageId>Plumsail.WorkflowCore.Providers.Redis</PackageId>
51+
</PropertyGroup>
52+
<PropertyGroup>
53+
<IncludeSymbols>true</IncludeSymbols>
54+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
55+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
56+
</PropertyGroup>
57+
</Project>
58+
XML
59+
60+
# Find project paths, compute version without touching csproj files
61+
- name: Resolve projects & version
62+
id: meta
63+
shell: bash
64+
run: |
65+
CORE_PROJ=$(git ls-files -- 'src/**/WorkflowCore.csproj' | head -n1)
66+
REDIS_PROJ=$(git ls-files -- 'src/**/WorkflowCore.Providers.Redis.csproj' | head -n1)
67+
[[ -n "$CORE_PROJ" && -n "$REDIS_PROJ" ]] || { echo "Projects not found"; exit 1; }
68+
69+
BASE_VER=$(grep -oP '(?<=<Version>)[^<]+' "$CORE_PROJ" || echo "0.0.0")
70+
if [[ -n "${{ github.event.inputs.newVersion }}" ]]; then
71+
VER="${{ github.event.inputs.newVersion }}"
72+
else
73+
VER="${BASE_VER}-plumsail-ci${{ github.run_id }}"
74+
fi
75+
76+
echo "core=$CORE_PROJ" >> $GITHUB_OUTPUT
77+
echo "redis=$REDIS_PROJ" >> $GITHUB_OUTPUT
78+
echo "version=$VER" >> $GITHUB_OUTPUT
79+
80+
- name: Pack Plumsail.WorkflowCore
81+
run: dotnet pack "${{ steps.meta.outputs.core }}" -c Release -o artifacts -p:Version="${{ steps.meta.outputs.version }}"
82+
83+
- name: Pack Plumsail.WorkflowCore.Providers.Redis
84+
run: dotnet pack "${{ steps.meta.outputs.redis }}" -c Release -o artifacts -p:Version="${{ steps.meta.outputs.version }}" -p:PackProjectReferences=false
85+
86+
- name: Publish nupkg
87+
run: dotnet nuget push "artifacts/*.nupkg" --api-key AzureArtifacts --source "${{ env.FEED_URL }}" --skip-duplicate
88+
89+
- name: Publish snupkg
90+
run: dotnet nuget push "artifacts/*.snupkg" --api-key AzureArtifacts --source "${{ env.FEED_URL }}" --skip-duplicate

0 commit comments

Comments
 (0)