JensKrumsieck/ChemSharp

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: Publish
on:
  push:
    tags:
      - v*.*.*

  workflow_dispatch:

jobs:
  publish:
    runs-on: windows-latest

    steps:
    - uses: smartsquaregmbh/delete-old-packages@v0.4.0
      with:
        keep: 10
        version-pattern: "\\d*\\.\\d*\\.\\d*-\\w*\\.\\d*"
        names: |
          ChemSharp
          ChemSharp.Spectroscopy
          ChemSharp.Molecules
          ChemSharp.Molecules.Blazor
          ChemSharp.UnitConversion
    - uses: actions/checkout@v2  
    - name: Setup .NET 6
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: |
          7.0.x
          6.0.x
          5.0.x
          3.1.x
          2.1.x
      env:
        NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
    - name: Install dependencies
      run: dotnet restore -s https://api.nuget.org/v3/index.json
    - name: Build
      run: dotnet build --configuration Release --no-restore
    - name: Test
      run: dotnet test --no-restore --verbosity normal
    - name: Pack
      run: dotnet pack -c Release --no-restore --no-build
    - run: cd ../
    - name: publish nuget
      run: dotnet nuget push **\*.nupkg --skip-duplicate --no-symbols -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json  
    - name: publish github
      run: dotnet nuget push **\*.nupkg --skip-duplicate --no-symbols -k ${{secrets.GITHUB_TOKEN}} -s https://nuget.pkg.github.com/JensKrumsieck/index.json