tuyen-vuduc is publishing NuGet π #13
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 | |
run-name: ${{ github.actor }} is publishing NuGet π | |
on: | |
push: | |
branches: [ main, master ] | |
# pull_request: | |
# branches: [ main, master ] | |
jobs: | |
build-then-publish: | |
environment: production | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Xamarin.iOS package using Homebrew | |
run: | | |
brew install --cask xamarin-ios | |
- name: Setup .NET Core SDK 8.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0' | |
- name: Install ios workload | |
run: | | |
dotnet workload install ios | |
- name: Build | |
run: | | |
sh build.sh --target=nuget --base-path=$PWD | |
- name: Publish NuGet and symbols | |
id: nuget-push | |
uses: edumserrano/[email protected] | |
with: | |
api-key: '${{ secrets.NUGET_PUSH_API_KEY }}' # this example is using GitHub secrets to pass the API key | |
working-directory: 'nugets' | |
# The next step is using powershell to parse the action's output but you can use whatever you prefer. | |
# Note that in order to read the step outputs the action step must have an id. | |
- name: Log output | |
if: steps.nuget-push.conclusion != 'skipped' && always() # run regardless if the previous step failed or not, just as long as it wasn't skipped | |
shell: pwsh | |
run: | | |
$pushResult = '${{ steps.nuget-push.outputs.push-result }}' | ConvertFrom-Json | |
$pushResultAsJsonIndented = ConvertTo-Json $pushResult | |
Write-Output $pushResultAsJsonIndented # outputs the result of the nuget push operation as an indented JSON string | |
Write-Output '${{ steps.nuget-push.outputs.status }}' # outputs the overall status of the nuget push action | |
# iterates over all list of packages and outputs the data from the nuget push operation for each | |
foreach($package in $pushResult.packages) { | |
Write-Output "$($package.status)" # outputs the status of the nuget push operation | |
Write-Output "$($package.package)" # outputs the NuGet package name that was pushed | |
Write-Output "$($package.symbols)" # outputs the symbols package name that was pushed | |
} |