name: Build on: [push, pull_request] jobs: build: strategy: matrix: operating-system: ["windows", "macos", "ubuntu"] dotnet-version: ["7.0.x"] runs-on: ${{ matrix.operating-system }}-latest steps: - uses: actions/checkout@v3 - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet-version }} - uses: actions/cache@v3 with: path: ~/.nuget/packages # Look to see if there is a cache hit for the corresponding requirements file key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: | ${{ runner.os }}-nuget - name: Install dependencies run: dotnet restore - name: Build run: dotnet build --configuration Release --no-restore - name: Test run: dotnet test --no-restore --verbosity normal publish: needs: build if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} runs-on: ubuntu-latest permissions: packages: write contents: read steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup .NET Core SDK uses: actions/setup-dotnet@v3 - uses: actions/cache@v3 with: path: ~/.nuget/packages # Look to see if there is a cache hit for the corresponding requirements file key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: | ${{ runner.os }}-nuget - name: Install dependencies run: dotnet restore - name: Build the package run: dotnet build --configuration Release --no-restore -p:SymbolPackageFormat=symbols.nupkg - name: Publish the package run: dotnet nuget push src/Xdg.Directories/bin/Release/*.symbols.nupkg -s https://nuget.pkg.github.com/SamTherapy/index.json -k ${{ secrets.GITHUB_TOKEN }}