Publish NuGet #8
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: 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 NetPalette/NetPalette.csproj | Select-String -Pattern "<Version>(.*)</Version>").Matches.Groups[1].Value) | |
$env:CURRENT_VERSION = $version.ToString() | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Build | |
run: | | |
dotnet workload install maui --ignore-failed-sources | |
cd NetPalette | |
dotnet restore | |
dotnet build --no-restore --configuration Release | |
- name: Publish NuGet | |
# You may pin to the exact commit or the version. | |
# uses: brandedoutcast/publish-nuget@c12b8546b67672ee38ac87bea491ac94a587f7cc | |
uses: alirezanet/publish-nuget@v3.0.4 | |
with: | |
# Filepath of the project to be packaged, relative to root of repository | |
PROJECT_FILE_PATH: NetPalette/NetPalette.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/nuget-publish-to-github-packages-action@v2.1 | |
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 Tag | |
run: git tag -a v${{ steps.get_version.outputs.CURRENT_VERSION }} -m "v${{ steps.get_version.outputs.CURRENT_VERSION }}" | |
- name: Push Tag | |
run: git push origin v${{ steps.get_version.outputs.CURRENT_VERSION }} |