Skip to content

Publish NuGet

Publish NuGet #31

Workflow file for this run

name: Publish NuGet
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get Version via powershell
id: get_version
run: |
$version = [System.Version]::Parse((Get-Content Maui.ColorPicker/Maui.ColorPicker.csproj | Select-String -Pattern "<Version>(.*)</Version>").Matches.Groups[1].Value)
$env:CURRENT_VERSION = $version.ToString()
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Build
run: |
cd Maui.ColorPicker
dotnet workload restore
dotnet restore
dotnet build --configuration Release
- name: Publish NuGet
# You may pin to the exact commit or the version.
# uses: brandedoutcast/publish-nuget@c12b8546b67672ee38ac87bea491ac94a587f7cc
uses: alirezanet/[email protected]
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: Maui.ColorPicker/Maui.ColorPicker.csproj
# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
- name: Push Nupkg to GitHub Packages
# You may pin to the exact commit or the version.
# uses: tanaka-takayoshi/nuget-publish-to-github-packages-action@462b6006e5c90f732d030b0ace2c3e7ee9d550bc
uses: tanaka-takayoshi/[email protected]
with:
# Path of NuPkg
nupkg-path: '**/*.nupkg'
# package repository owner
repo-owner: nor0x
# user account
gh-user: nor0x
# access token
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
custom_tag: ${{ steps.get_version.outputs.CURRENT_VERSION }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.get_version.outputs.CURRENT_VERSION }}
body: |
# Release ${{ steps.get_version.outputs.CURRENT_VERSION }}
This release is based on the commit: ${{ github.event.repository.full_name }}@${{ github.sha }}.