-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created build and publish script for the nuget
- Loading branch information
1 parent
bba8256
commit f76f38d
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# based on: https://github.com/Redth/Maui.ContentButton/blob/main/.github/workflows/build-publish.yml | ||
name: Build and Publish | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
env: | ||
NUPKG_MAJOR: 0.999 | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Build | ||
run: dotnet build --configuration Release | ||
- name: Package NuGets | ||
shell: pwsh | ||
run: | | ||
$VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID" | ||
if ($env:GITHUB_EVENT_NAME -eq "release") { | ||
$VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1) | ||
} | ||
echo "::set-output name=pkgverci::$VERSION" | ||
echo "PACKAGE VERSION: $VERSION" | ||
New-Item -ItemType Directory -Force -Path .\artifacts | ||
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj | ||
- name: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: NuGet | ||
path: ./artifacts | ||
|
||
# publish: | ||
# name: Publish | ||
# needs: build | ||
# runs-on: windows-latest | ||
# if: github.event_name == 'release' | ||
# steps: | ||
# - name: Download Artifacts | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: NuGet | ||
# - name: Setup .NET | ||
# uses: actions/setup-dotnet@v3 | ||
# with: | ||
# dotnet-version: '8.0.x' | ||
# - name: Push NuGet | ||
# run: | | ||
# dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} |