Skip to content

Merge pull request #30 from AngeloDotNet/develop #15

Merge pull request #30 from AngeloDotNet/develop

Merge pull request #30 from AngeloDotNet/develop #15

name: Build and Pack Common
on:
push:
branches: [ main ]
paths: [ 'src/GSWCloudApp.Common/**' ]
workflow_dispatch:
env:
NET_VERSION: '8.x'
PROJECT_NAME: src/GSWCloudApp.Common
PROJECT_FILE: GSWCloudApp.Common.csproj
TAG_NAME: Common
RELEASE_NAME: GSWCloudApp.Common
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET Core SDK ${{ env.NET_VERSION }}
uses: actions/[email protected]
with:
dotnet-version: ${{ env.NET_VERSION }}
- name: Nerdbank.GitVersioning
uses: dotnet/[email protected]
id: nbgv
with:
path: ${{ env.PROJECT_NAME }}
- name: Package
run: dotnet pack -c Release -o . '${{ env.PROJECT_NAME }}/${{ env.PROJECT_FILE }}' -p:Version=${{ steps.gitversion.outputs.SemVer }}
- name: Publish on NuGet
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate
- name: Publish on GitHub
run: |
dotnet nuget add source --username USERNAME --password ${{ secrets.RELEASE_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push **\*.nupkg --source github --api-key ${{ secrets.RELEASE_TOKEN }} --skip-duplicate
- name: Create release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}_v${{ steps.nbgv.outputs.NuGetPackageVersion }}
release_name: ${{ env.RELEASE_NAME }} ${{ steps.nbgv.outputs.NuGetPackageVersion }}
draft: false
prerelease: false