Skip to content
name: Test pack and Publish to NuGet
on: push
# release:
# types: [published]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.425'
- name: Restore dependencies
working-directory: ./src/permit
run: dotnet restore
- name: Insert Token to tests file by secret API key
run: |
sed -i 's/private string testToken = "";/private string testToken = "${{ secrets.PERMIT_API_KEY }}";/' ./tests/PermitTests/PermitClientTests.cs
cat ./tests/PermitTests/PermitClientTests.cs
- name: Install Docker
uses: docker-practice/actions-setup-docker@master
- name: Run local PDP
env:
PDP_API_KEY: ${{ secrets.PERMIT_API_KEY }}
PERMIT_API_KEY: ${{ secrets.PERMIT_API_KEY }}
PDP_DEBUG: true
run: docker run -d -p 7766:7000 permitio/pdp-v2:latest
- name: Run Tests
working-directory: ./tests/PermitTests
run: |
dotnet test --configuration Release
- name: Build project
working-directory: ./src/permit
run: dotnet build --configuration Release
# - 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