Pack & push to nuget. #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ dev ] | |
| paths: | |
| - "**/*.csproj" | |
| - "Directory.Build.props" | |
| - ".github/workflows/ci.yml" | |
| jobs: | |
| pack-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.304' | |
| - name: Set VERSION sufix for CI | |
| run: echo "VERSION_SUFFIX=-ci-$(date +'%Y%m%d%H%M%S').${{ github.run_number }}" >> $GITHUB_ENV | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Add GitHub Packages as a NuGet source | |
| run: | | |
| dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ | |
| --name "github" \ | |
| --username "${{ github.actor }}" \ | |
| --password "${{ secrets.GITHUB_TOKEN }}" \ | |
| --store-password-in-clear-text \ | |
| || true | |
| - name: Pack and push NuGet packages | |
| run: | | |
| for nupkg in ./artifacts/*.nupkg; do | |
| dotnet nuget push "$nupkg" --source "github" --skip-duplicate; | |
| done |