Skip to content

update: reworked PyCS console capabilities #30

update: reworked PyCS console capabilities

update: reworked PyCS console capabilities #30

Workflow file for this run

name: Build & Publish NuGet to GitHub Registry
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
#Install and calculate the new version with GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.10.2
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.10.2
id: gitversion # step id used as reference for output values
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
# Build/pack the project
- name: Setup .NET
uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 7.0.x
- name: Build and Pack NuGet package with versioning
run: dotnet pack ${{ vars.CS_PROJ_PATH }} -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: bin/Release/*.nupkg
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master' # only run job if on the master branch
steps:
#Push NuGet package to GitHub packages
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: nugetPackage
- name: Prep packages
run: dotnet nuget add source --username ${{ vars.USERNAME }} --password ${{ secrets.NUGET_PACKAGE_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ vars.USERNAME }}/index.json"
- name: Push package to GitHub packages
# if: needs.build.outputs.CommitsSinceVersionSource > 0
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.NUGET_PACKAGE_TOKEN }} --source "github" --skip-duplicate
# Publish to NuGet.org
- name: Publish to NuGet.org
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
#Create release
- name: Create Release
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
uses: ncipollo/release-action@v1.13.0
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
artifacts: "nugetPackage/*"
token: ${{ secrets.NUGET_PACKAGE_TOKEN }}