Skip to content

Commit 63c1155

Browse files
feature: this commit introduces a pipeline to publish the comanda contracts artifacts
1 parent 0c7d763 commit 63c1155

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: publish comanda.internal.contracts artifacts package to nuget
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- development
8+
paths:
9+
- 'Artifacts/Comanda.Internal.Contracts/**'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
15+
defaults:
16+
run:
17+
working-directory: Artifacts/Comanda.Internal.Contracts
18+
19+
steps:
20+
- name: checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: '9.0.x'
27+
28+
- name: restore dependencies
29+
run: dotnet restore
30+
31+
- name: build
32+
run: dotnet build --configuration Release --no-restore
33+
34+
- name: set version and pack
35+
id: pack
36+
run: |
37+
BASE_VERSION="1.0"
38+
39+
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
40+
VERSION="${BASE_VERSION}.${GITHUB_RUN_NUMBER}"
41+
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
42+
VERSION="${BASE_VERSION}-beta.${GITHUB_RUN_NUMBER}"
43+
else
44+
echo "branch not configured for publication"
45+
exit 1
46+
fi
47+
48+
echo "use version: $VERSION"
49+
dotnet pack -c Release -p:PackageVersion=$VERSION -o ./output --no-build
50+
51+
echo "package_version=$VERSION" >> $GITHUB_OUTPUT
52+
53+
- name: push package to nuget
54+
run: dotnet nuget push ./output/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)