Merge pull request #39 from saturdaymp/release/8.0.0 #124
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ main, release/* ] | |
| tags: [ v* ] | |
| pull_request: | |
| branches: [ main, release/* ] | |
| jobs: | |
| build: | |
| name: Build and Test | |
| runs-on: macos-15 | |
| outputs: | |
| version: ${{ steps.gitversion.outputs.semVer }} | |
| defaults: | |
| run: | |
| working-directory: Source | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Required for Calculate Version step (e.g. GitVersion) | |
| - name: Install .NET 8.0 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 8.0 | |
| - name: Install Workloads | |
| run: dotnet workload restore | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@51d325634925d7d9ce0a7efc2c586c0bc2b9eee6 #v3.2.1 | |
| with: | |
| versionSpec: '6.3.0' | |
| - name: Determine Version | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@51d325634925d7d9ce0a7efc2c586c0bc2b9eee6 #v3.2.1 | |
| with: | |
| useConfigFile: true | |
| updateProjectFiles: true | |
| - name: NuGet Restore | |
| run: dotnet restore | |
| # Smoke test to make sure the Example Client builds. We don't do a release build | |
| # of the Example Client because it takes a long time and we don't publish it. | |
| - name: Debug Build of Solution to Smoke Test Example Client | |
| run: dotnet build -c Debug | |
| - name: Create NuGet Package | |
| run: dotnet pack SaturdayMP.XPlugins.iOS.BEMCheckBox/SaturdayMP.XPlugins.iOS.BEMCheckBox.csproj -c Release | |
| - name: Upload NuGet Package Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: Source/SaturdayMP.XPlugins.iOS.BEMCheckBox/bin/Release/SaturdayMP.XPlugins.iOS.BEMCheckBox.${{ steps.gitversion.outputs.semVer }}.nupkg | |
| retention-days: 90 | |
| - name: Publish to MyGet | |
| run: dotnet nuget push SaturdayMP.XPlugins.iOS.BEMCheckBox/bin/Release/SaturdayMP.XPlugins.iOS.BEMCheckBox.${{ steps.gitversion.outputs.semVer }}.nupkg -k ${{ secrets.MYGET_API_KEY }} -s https://www.myget.org/F/saturdaymp/api/v3/index.json | |
| publish-nuget: | |
| name: Publish to NuGet | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write # Required for Trusted Publishing (OIDC token generation) | |
| steps: | |
| - name: Install .NET 8.0 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 8.0 | |
| - name: Download NuGet Package Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./packages | |
| # Authenticate to NuGet.org using Trusted Publishing (OIDC) | |
| - name: Login to NuGet | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: ${{ secrets.NUGET_USERNAME }} | |
| # Only push tagged builds to NuGet. These will be production or release candidates. | |
| - name: Publish to NuGet | |
| run: dotnet nuget push ./packages/SaturdayMP.XPlugins.iOS.BEMCheckBox.${{ needs.build.outputs.version }}.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY}} --skip-duplicate --no-symbols -s https://api.nuget.org/v3/index.json |