Add Gitea workflow to pack and publish NuGet packages on push
Some checks failed
NuGet Package Publish / nuget (push) Failing after 1m9s
Some checks failed
NuGet Package Publish / nuget (push) Failing after 1m9s
This commit is contained in:
50
.gitea/workflows/nuget.yml
Normal file
50
.gitea/workflows/nuget.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: NuGet Package Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nuget:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
|
||||||
|
- name: Restore
|
||||||
|
run: dotnet restore CBDDC.Libs.slnx
|
||||||
|
|
||||||
|
- name: Pack
|
||||||
|
run: dotnet pack CBDDC.Libs.slnx --configuration Release --no-restore --output artifacts/nuget
|
||||||
|
|
||||||
|
- name: Publish to Gitea NuGet
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
NUGET_SOURCE_URL: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/nuget/index.json
|
||||||
|
NUGET_USERNAME: ${{ secrets.NUGET_USERNAME || github.actor }}
|
||||||
|
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ -z "${NUGET_TOKEN:-}" ]; then
|
||||||
|
echo "NUGET_TOKEN and GITHUB_TOKEN are both unavailable."
|
||||||
|
echo "Configure one of: secrets.NUGET_TOKEN (preferred) or secrets.GITHUB_TOKEN."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dotnet nuget add source "$NUGET_SOURCE_URL" \
|
||||||
|
--name gitea \
|
||||||
|
--username "$NUGET_USERNAME" \
|
||||||
|
--password "$NUGET_TOKEN" \
|
||||||
|
--store-password-in-clear-text
|
||||||
|
|
||||||
|
find artifacts/nuget -name '*.nupkg' ! -name '*.symbols.nupkg' -print0 | \
|
||||||
|
xargs -0 -I{} dotnet nuget push "{}" \
|
||||||
|
--source gitea \
|
||||||
|
--api-key "$NUGET_TOKEN" \
|
||||||
|
--skip-duplicate
|
||||||
Reference in New Issue
Block a user