- Release v1.0.0 #1
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: release-ci | |
| on: | |
| push: | |
| branches: | |
| - release/** | |
| - release | |
| permissions: | |
| contents: read | |
| jobs: | |
| Build-Test-Publish: | |
| runs-on: ubuntu-latest | |
| env: | |
| working-directory: ${{ github.workspace }} | |
| github-token: '${{ secrets.GH_Packages }}' | |
| nuget-token: '${{ secrets.NUGET_API_KEY }}' | |
| steps: | |
| - name: Step-01 Install GitVersion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| versionSpec: 5.x | |
| - name: Step-02 Check out Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Step-03 Calculate Version | |
| id: gitversion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| useConfigFile: true | |
| - name: Step-04 Display Version Info | |
| run: | | |
| echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}" | |
| echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}" | |
| echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}" | |
| echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}" | |
| - name: Step-05 Install .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Step-06 Restore dependencies | |
| run: dotnet restore | |
| working-directory: '${{ env.working-directory }}' | |
| - name: Step-07 Build Version (Stable) | |
| run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} | |
| working-directory: '${{ env.working-directory }}' | |
| - name: Step-08 Test Solution | |
| run: dotnet test --configuration Release --no-build --no-restore --verbosity normal | |
| working-directory: '${{ env.working-directory }}' | |
| - name: Step-09 Create NuGet Package | |
| run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} | |
| working-directory: '${{ env.working-directory }}' | |
| - name: Step-10 Publish to Github Packages | |
| run: | | |
| dotnet tool install gpr --global | |
| find ./packages -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \; | |
| working-directory: '${{ env.working-directory }}' | |
| - name: Step-11 Publish to NuGet.org | |
| if: ${{ env.nuget-token != '' }} | |
| run: | | |
| find ./packages -name "*.nupkg" -print -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \; | |
| working-directory: '${{ env.working-directory }}' |