Skip to content

Packing Nuget artifacts only once after builds #157

Packing Nuget artifacts only once after builds

Packing Nuget artifacts only once after builds #157

Workflow file for this run

name: Webhooks CD
permissions:
contents: read
packages: write
on:
push:
branches: [ main ]
jobs:
build:
name: "Build and Test"
strategy:
fail-fast: true
matrix:
dotnet-verion: [ '6.0.x', '7.0.x', '8.0.x' ]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET ${{ matrix.dotnet-version }}}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
# - name: Add Deveel GitHub NuGet Source
# run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*"
- name: Collect to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.OCM_CODECOV_TOKEN }}
pack:
needs: build
name: "Pack"
runs-on: ubuntu-latest
steps:
- name: Pack
run: dotnet pack --configuration Release --no-restore --no-build --include-symbols --version-suffix $GITHUB_RUN_ID --output ./nuget
- name: Push Packages to GitHub NuGet
run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/deveel/index.json"
clean:
needs: build
name: "Clean Old Packages"
uses: ./.github/workflows/clean-packages.yml