diff options
author | Matt Strapp <matt@mattstrapp.net> | 2024-08-06 14:01:38 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2024-08-06 14:01:38 -0500 |
commit | be1f06a4aa6d4a2ac253b33b405fe96862d3c906 (patch) | |
tree | 1a1933934e25df618352d432bac2762937dcfb2d /.github | |
parent | Format all documentation (diff) | |
download | locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar.gz locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar.bz2 locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar.lz locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar.xz locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.tar.zst locusts-be1f06a4aa6d4a2ac253b33b405fe96862d3c906.zip |
Add .NET
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/dotnet.yml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..c95302a --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,80 @@ +name: Build + +on: + push: + paths: + - "**.cs" + - "**.csproj" + - "**.sln" + pull_request: + paths: + - "**.cs" + - "**.csproj" + - "**.sln" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + cache: true + - name: Install dependencies + run: dotnet restore + - name: Test + run: dotnet test --no-restore + + publish-preview: + needs: build + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + source-url: https://nuget.pkg.github.com/locusts-r-us/index.json + cache: true + env: + NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies + run: dotnet restore + - name: Build the package + run: dotnet build --configuration Release --no-restore -p:SymbolPackageFormat=symbols.nupkg # GitHub Packages does not support snupkg + - name: Publish the package + run: dotnet nuget push src/bin/Release/*.symbols.nupkg + + publish-release: + needs: build + if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + - 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/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json + env: + NUGET_API_KEY: ${{ secrets.NUGET_KEY }}
\ No newline at end of file |