Skip to content

tuyen-vuduc is publishing NuGet πŸš€ #23

tuyen-vuduc is publishing NuGet πŸš€

tuyen-vuduc is publishing NuGet πŸš€ #23

Workflow file for this run

name: Publish Nuget
run-name: ${{ github.actor }} is publishing NuGet πŸš€
on:
workflow_dispatch:
inputs:
SHOULD_RUN:
description: 'True to run'
required: true
type: boolean
jobs:
build-then-publish:
environment: production
runs-on: macos-latest
if: ${{ inputs.SHOULD_RUN }}
steps:
- uses: actions/checkout@v3
- name: Set .netrc
run: |
echo $NETRC >> ~/.netrc
cat ~/.netrc
shell: bash
env:
NETRC : ${{secrets.NETRC}}
- name: Setup .NET Core SDK 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'
- name: Install ios workload
run: |
dotnet workload install ios android maui maui-ios maui-android
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
- name: Xcode Select Version
uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: 15.1
- name: Set MAPBOX_DOWNLOADS_TOKEN
if: contains(${{ inputs.LIB_ARTIFACT }}, 'com.mapbox.maps')
run: |
echo "MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN" >> ~/.gradle/gradle.properties
cat ~/.gradle/gradle.properties
shell: bash
env:
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
- name: Create MauiProgram.dev.cs
run: |
cp src/qs/MapboxMauiQs/MauiProgram.dev.cs.example src/qs/MapboxMauiQs/MauiProgram.dev.cs
# - name: Create MapboxMauiQs.props
# run: |
# echo "${{ secrets.PROJECT_PROPS }}" > src/qs/MapboxMauiQs/MapboxMauiQs.props
- name: Build
run: |
sh build.sh
env:
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
- 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
}