use PAT to authenticate to package feed #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nuget | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '7.0' | |
- run: dotnet build -c release | |
# - name: dotnet test | |
# run: dotnet test -c release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | |
# env: | |
# TOKEN: ${{secrets.AZURE_DEVOPS_TOKEN}} | |
# - uses: codecov/codecov-action@v1 | |
pack: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '7.0' | |
source-url: https://nuget.pkg.github.com/azure-devops-compliance/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: dotnet pack | |
run: | | |
export VERSION=$(git rev-list --count HEAD) | |
dotnet pack -c release -o out -p:PackageVersion=1.0.0.$VERSION | |
- name: dotnet nuget push | |
run: dotnet nuget push ./out/*.nupkg --skip-duplicate --no-symbols true --api-key ${{secrets.PAT}} |