Xdg.Directories/.github/workflows/build-test.yaml
Sam Therapy ee4f03ff0b
All checks were successful
Public Preview Builds / publish-preview (push) Successful in 1m33s
Bump dependencies
2024-10-10 15:44:38 +02:00

93 lines
No EOL
3.1 KiB
YAML

name: Build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
operating-system: ["windows", "macos", "ubuntu"]
dotnet-version: ["8.0.x"]
runs-on: ${{ matrix.operating-system }}-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
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-preview:
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@v4
with:
fetch-depth: 0
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- 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/xdg-net/index.json -k ${{ secrets.GITHUB_TOKEN }}
publish-release:
needs: build
if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- name: Install dependencies
run: dotnet restore
- name: Build the package
run: dotnet build --configuration Release --no-restore -p:SymbolPackageFormat=snupkg
- name: Publish the package
run: |
dotnet nuget push src/Xdg.Directories/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }}
env:
NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
- name: Make a GitHub release
uses: softprops/action-gh-release@v2
with:
files: src/Xdg.Directories/bin/Release/*.nupkg
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true