|
| 1 | +# based on: https://github.com/Redth/Maui.ContentButton/blob/main/.github/workflows/build-publish.yml |
| 2 | +name: Build and Publish |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + release: |
| 9 | + types: [published] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build |
| 14 | + env: |
| 15 | + NUPKG_MAJOR: 0.999 |
| 16 | + runs-on: windows-latest |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v2 |
| 20 | + - name: Setup .NET |
| 21 | + uses: actions/setup-dotnet@v3 |
| 22 | + with: |
| 23 | + dotnet-version: 9.0.x |
| 24 | + - name: Install .NET MAUI |
| 25 | + shell: pwsh |
| 26 | + run: | |
| 27 | + & dotnet nuget locals all --clear |
| 28 | +# & dotnet workload install maui --source https://api.nuget.org/v3/index.json |
| 29 | +# & dotnet workload install android ios maccatalyst tvos macos maui wasm-tools maui-maccatalyst --source https://api.nuget.org/v3/index.json |
| 30 | + - name: Build |
| 31 | + run: dotnet build --configuration Release ./src |
| 32 | + - name: Package NuGets |
| 33 | + shell: pwsh |
| 34 | + run: | |
| 35 | + $VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID" |
| 36 | + if ($env:GITHUB_EVENT_NAME -eq "release") { |
| 37 | + $VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1) |
| 38 | + } |
| 39 | + echo "pkgverci=$VERSION" >> $GITHUB_OUTPUT |
| 40 | + echo "PACKAGE VERSION: $VERSION" |
| 41 | + |
| 42 | + New-Item -ItemType Directory -Force -Path .\artifacts |
| 43 | + dotnet pack --output ./artifacts --configuration Release ./src/SharedXFormCoreLibrary/SharedXFormCoreLibrary.csproj |
| 44 | +# dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/Print3dServer.Core/Print3dServer.Core.csproj |
| 45 | +# echo "::set-output name=pkgverci::$VERSION" |
| 46 | + |
| 47 | + - name: Artifacts |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: NuGet |
| 51 | + path: ./artifacts |
| 52 | + |
| 53 | +# publish: |
| 54 | +# name: Publish |
| 55 | +# needs: build |
| 56 | +# runs-on: windows-latest |
| 57 | +# if: github.event_name == 'release' |
| 58 | +# steps: |
| 59 | +# - name: Download Artifacts |
| 60 | +# uses: actions/download-artifact@v4 |
| 61 | +# with: |
| 62 | +# name: NuGet |
| 63 | +# - name: Setup .NET |
| 64 | +# uses: actions/setup-dotnet@v3 |
| 65 | +# with: |
| 66 | +# dotnet-version: '9.0.x' |
| 67 | +# - name: Push NuGet |
| 68 | +# run: | |
| 69 | +# dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} |
0 commit comments