|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: windows-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + |
| 18 | + - uses: microsoft/setup-msbuild@v1 |
| 19 | + - uses: NuGet/setup-nuget@v1.0.5 |
| 20 | + |
| 21 | + - name: Restore NuGet packages |
| 22 | + run: nuget restore NHtmlUnit.sln |
| 23 | + |
| 24 | + - uses: gittools/actions/gitversion/setup@v0.9.9 |
| 25 | + with: |
| 26 | + versionSpec: '5.x.x' |
| 27 | + |
| 28 | + - uses: gittools/actions/gitversion/execute@v0.9.9 |
| 29 | + id: gitversion # step id used as reference for output values |
| 30 | + with: |
| 31 | + updateAssemblyInfo: true |
| 32 | + |
| 33 | + - name: Build Solution |
| 34 | + run: msbuild NHtmlUnit.sln /property:Configuration=Release |
| 35 | + |
| 36 | + - name: Test Solution |
| 37 | + run: packages\NUnit.ConsoleRunner.3.12.0\tools\nunit3-console.exe tests\IntegrationTests\bin\Release\IntegrationTests.dll |
| 38 | + |
| 39 | + - name: Create NuGet Package |
| 40 | + run: nuget.exe pack NHtmlUnit.nuspec -Verbosity detailed -Symbols -Properties Configuration=Release -Version ${{ steps.gitversion.outputs.nuGetVersion }} |
| 41 | + |
| 42 | + - uses: actions/upload-artifact@v2 |
| 43 | + with: |
| 44 | + name: NHtmlUnit.nupkg |
| 45 | + path: '*.nupkg' |
| 46 | + |
| 47 | + release: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + needs: build |
| 50 | + if: startsWith(github.ref, 'refs/tags/') # Only release tagged commits |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/download-artifact@v2 |
| 54 | + with: |
| 55 | + name: NHtmlUnit.nupkg |
| 56 | + |
| 57 | + - name: Upload .nupkg to release |
| 58 | + uses: meeDamian/github-release@2.0 |
| 59 | + with: |
| 60 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + files: '*.nupgk' |
| 62 | + |
| 63 | + publish: |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: build |
| 66 | + |
| 67 | + steps: |
| 68 | + - uses: actions/download-artifact@v2 |
| 69 | + with: |
| 70 | + name: NHtmlUnit.nupkg |
| 71 | + |
| 72 | + - uses: NuGet/setup-nuget@v1.0.5 |
| 73 | + |
| 74 | + - name: Publish To NuGet.org |
| 75 | + # if: startsWith(github.ref, 'refs/tags/') # Only publish tagged commits |
| 76 | + run: nuget push *.nupkg -Source nuget.org -ApiKey ${{ secrets.NUGET_API_KEY }} |
0 commit comments