Files
CBDD/.gitea/workflows/nuget-publish.yml
Joseph Doherty 528939d3a0
Some checks failed
NuGet Publish / build-and-pack (push) Failing after 24s
NuGet Publish / publish-to-gitea (push) Has been skipped
Add Gitea NuGet publish workflow and finalize current storage/index/docs updates.
2026-02-20 13:32:10 -05:00

77 lines
2.5 KiB
YAML

name: NuGet Publish
on:
push:
branches:
- "**"
jobs:
build-and-pack:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore CBDD.slnx
- name: Build
run: dotnet build CBDD.slnx -c Release --no-restore
- name: Pack NuGet Packages
run: |
mkdir -p nupkgs
dotnet pack src/CBDD/ZB.MOM.WW.CBDD.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.Bson/ZB.MOM.WW.CBDD.Bson.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.Core/ZB.MOM.WW.CBDD.Core.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.SourceGenerators/ZB.MOM.WW.CBDD.SourceGenerators.csproj -c Release -o nupkgs --no-build
- name: Upload Package Artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: nupkgs/*.nupkg
publish-to-gitea:
needs: build-and-pack
runs-on: ubuntu-latest
if: ${{ gitea.ref == 'refs/heads/main' && secrets.GITEA_NUGET_USERNAME != '' && secrets.GITEA_NUGET_TOKEN != '' }}
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore CBDD.slnx
- name: Build
run: dotnet build CBDD.slnx -c Release --no-restore
- name: Pack NuGet Packages
run: |
mkdir -p nupkgs
dotnet pack src/CBDD/ZB.MOM.WW.CBDD.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.Bson/ZB.MOM.WW.CBDD.Bson.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.Core/ZB.MOM.WW.CBDD.Core.csproj -c Release -o nupkgs --no-build
dotnet pack src/CBDD.SourceGenerators/ZB.MOM.WW.CBDD.SourceGenerators.csproj -c Release -o nupkgs --no-build
- name: Configure Gitea NuGet Source
run: |
dotnet nuget add source \
"https://gitea.dohertylan.com/api/packages/dohertj2/nuget/index.json" \
--name gitea \
--username "${{ secrets.GITEA_NUGET_USERNAME }}" \
--password "${{ secrets.GITEA_NUGET_TOKEN }}" \
--store-password-in-clear-text
- name: Publish Packages
run: |
for pkg in nupkgs/*.nupkg; do
if [ -f "$pkg" ] && [[ "$pkg" != *.snupkg ]]; then
dotnet nuget push "$pkg" --source gitea --skip-duplicate
fi
done