Skip to content

release v2.0.3 (#39) #20

release v2.0.3 (#39)

release v2.0.3 (#39) #20

Workflow file for this run

name: Package Release to GitHub and Nuget
on:
workflow_dispatch:
push:
branches:
- release/*
permissions:
contents: write
env:
DOTNET_VERSION: '10.0.x'
jobs:
package-build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.semver }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: '**/packages.lock.json'
- uses: dotnet/nbgv@master
id: nbgv
- name: export version to env
id: version
run: echo "semver=${{ steps.nbgv.outputs.SemVer2 }}" >> "$GITHUB_OUTPUT"
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --no-restore -c Release
- name: Generate Nuget Package
run: dotnet pack --no-build -c Release --output ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg
retention-days: 1
release-github:
runs-on: ubuntu-latest
needs: package-build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v5
with:
name: nuget-packages
path: ./artifacts
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.package-build.outputs.version }}
tag_name: ${{ needs.package-build.outputs.version }}
target_commitish: ${{ github.ref }}
generate_release_notes: true
files: ./artifacts/*.nupkg
# if hyphen contains in the tag name, it will be prerelease
prerelease: ${{ contains(needs.package-build.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-nuget:
runs-on: ubuntu-latest
needs: package-build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v5
with:
name: nuget-packages
path: ./artifacts
- name: Publish Nuget Package
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}