|
| 1 | +name: "Build and Deploy" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - release |
| 7 | + paths-ignore: |
| 8 | + - '**/*.md' |
| 9 | + - '**/*.gitignore' |
| 10 | + - '**/*.gitattributes' |
| 11 | + workflow_dispatch: |
| 12 | + branches: |
| 13 | + - release |
| 14 | + paths-ignore: |
| 15 | + - '**/*.md' |
| 16 | + - '**/*.gitignore' |
| 17 | + - '**/*.gitattributes' |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + outputs: |
| 22 | + version: ${{ steps.set_proj_version.outputs.PKG_VERSION }} |
| 23 | + relnotes: ${{ steps.set_proj_version.outputs.RELNOTES }} |
| 24 | + name: Build |
| 25 | + runs-on: ubuntu-latest |
| 26 | + env: |
| 27 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 28 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
| 29 | + DOTNET_NOLOGO: true |
| 30 | + DOTNET_GENERATE_ASPNET_CERTIFICATE: false |
| 31 | + DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false |
| 32 | + DOTNET_MULTILEVEL_LOOKUP: 0 |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - name: Setup .NET Core SDK |
| 38 | + uses: actions/setup-dotnet@v1.9.0 |
| 39 | + with: |
| 40 | + dotnet-version: 6.0.x |
| 41 | + |
| 42 | + - name: Restore |
| 43 | + run: dotnet restore |
| 44 | + |
| 45 | + - name: Build |
| 46 | + run: dotnet build --configuration Release --no-restore |
| 47 | + |
| 48 | + - name: Test |
| 49 | + run: dotnet test |
| 50 | + |
| 51 | + - name: Pack |
| 52 | + run: dotnet pack Fritz.InstantAPIs/Fritz.InstantAPIs.csproj --configuration Release -o finalpackage --no-build |
| 53 | + |
| 54 | + - name: Publish artifact |
| 55 | + uses: actions/upload-artifact@master |
| 56 | + with: |
| 57 | + name: nupkg |
| 58 | + path: finalpackage |
| 59 | + |
| 60 | + - name: Get version |
| 61 | + id: set_proj_version |
| 62 | + shell: pwsh |
| 63 | + run: | |
| 64 | + [xml]$nuspec = Get-Content Fritz.InstantAPIs/Fritz.InstantAPIs.csproj |
| 65 | + $version=$nuspec.project.propertygroup.version |
| 66 | + $relnotes=$nuspec.project.propertygroup.packagereleasenotes |
| 67 | + echo "PKG_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append |
| 68 | + echo "RELNOTES=$relnotes" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append |
| 69 | +
|
| 70 | + - name: Push to NuGet |
| 71 | + run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate |
| 72 | + |
| 73 | + - name: Tag and Release |
| 74 | + id: tag_release |
| 75 | + uses: softprops/action-gh-release@v0.1.13 |
| 76 | + with: |
| 77 | + body: ${{ env.RELNOTES }} |
| 78 | + tag_name: ${{ env.PKG_VERSION }} |
| 79 | + files: | |
| 80 | + **/*.nupkg |
0 commit comments