Skip to content

v1.7.1

v1.7.1 #31

name: Test and Publish to NuGet
on:
release:
types: [published]
jobs:
test-dotnet-sdk:
runs-on: ubuntu-latest
timeout-minutes: 15
services:
pdp:
image: permitio/pdp-v2:latest
ports:
- 7766:7000
env:
PDP_API_KEY: ${{ secrets.PERMIT_API_KEY }}
PDP_DEBUG: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
- name: Restore dependencies
working-directory: ./src/permit
run: dotnet restore
- name: Run Tests
working-directory: ./tests/PermitTests
env:
PERMIT_API_KEY: ${{ secrets.PERMIT_API_KEY }}
run: dotnet test
# Job for building and publishing the NuGet package
build-and-publish:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: test-dotnet-sdk # Ensures the build runs only if the test job passes
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
- name: Restore dependencies
working-directory: ./src/permit
run: dotnet restore
- name: Update VersionPrefix in .csproj
run: |
sed -i 's/<VersionPrefix>.*<\/VersionPrefix>/<VersionPrefix>${{ github.event.release.tag_name }}<\/VersionPrefix>/g' ./src/permit/PermitSDK.csproj
cat ./src/permit/PermitSDK.csproj
- name: Pack project
working-directory: ./src/permit
run: dotnet pack --configuration Release
- name: Push package to NuGet
working-directory: ./src/permit
run: dotnet nuget push bin/Release/Permit.${{ github.event.release.tag_name }}.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json