<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RepositoryUrl>https://github.com/PATH/TO/REPOSITORY</RepositoryUrl>
</PropertyGroup>
</Project>
name: Build and Pack (push to github packages)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-Pack-Push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
PROJECT_NAME: #YOUR_PROJECT_NAME#
GITHUB_USER: #YOUR_GITHUB_USERNAME#
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion (by GitTools)
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Display Generated SemVer
run: |
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }}
- name: Authenticate to Github Packages
run: dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --username ${{ env.GITHUB_USER }} --password ${{ github.token }} --store-password-in-clear-text --name github
- name: Push to github packages
run: dotnet nuget push ${{ env.PROJECT_NAME }}/bin/Release/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ github.token }} --skip-duplicate