Skip to content

Build & Release .NET Package #26

Build & Release .NET Package

Build & Release .NET Package #26

Workflow file for this run

name: Build & Release .NET Package
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Publish
run: |
version=$(git describe --tags --abbrev=0)
projects=("BangumiNet.Api"
"BangumiNet.Common"
"BangumiNet.Archive"
"BangumiNet.BangumiData")
for project in "${projects[@]}"; do
dotnet pack $project -p:Version=${version#v} -c Release -o .
done
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: pkg-archive
path: BangumiNet.*nupkg
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v7
with:
name: pkg-archive
path: .
- name: Push
run: |
find . -name "*.nupkg" | while read -r pkg; do
dotnet nuget push $pkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
done