Merge branch 'master' into release #4
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: Build and publish | |
| on: | |
| push: | |
| branches: [ prerelease, release ] | |
| jobs: | |
| build: | |
| timeout-minutes: 10 | |
| runs-on: 'windows-2022' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: versionSuffix | |
| shell: pwsh | |
| run: | | |
| If('${{ github.ref_name }}' -eq 'release') | |
| { | |
| echo "versionSuffix=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
| } | |
| else | |
| { | |
| echo "versionSuffix=-preview" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
| } | |
| - name: Get version number | |
| shell: pwsh | |
| run: | | |
| $versionNumber = Get-Date -Format "yy.M.${{ github.run_number }}${{ env.versionSuffix }}" | |
| echo "versionNumber=$versionNumber" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
| - name: Setup MSBuild path | |
| uses: microsoft/setup-msbuild@v1.1 | |
| - name: Setup dot net | |
| uses: actions/setup-dotnet@v2 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Create nuget package | |
| run: dotnet pack ./MFilesAPI.Extensions/MFilesAPI.Extensions.csproj --configuration Release -p:Version=${{ env.versionNumber }} | |
| # Tests cannot be run as MFAPI is not installed. | |
| # - name: Test | |
| # run: dotnet test --no-restore --verbosity normal | |
| - name: Push with dotnet | |
| run: dotnet nuget push ./MFilesAPI.Extensions/bin/Release/MFilesAPI.Extensions.${{ env.versionNumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| - name: Create release | |
| id: createRelease | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| artifactErrorsFailBuild: true | |
| artifacts: "./MFilesAPI.Extensions/bin/Release/MFilesAPI.Extensions.${{ env.versionNumber }}.nupkg" | |
| name: ${{ env.versionNumber }} | |
| tag: ${{ env.versionNumber }} | |
| draft: false | |
| omitBody: true | |
| prerelease: ${{ env.versionSuffix == '' }} |