|
| 1 | +name: CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: master |
| 6 | + pull_request: |
| 7 | + branches: master |
| 8 | + |
| 9 | +env: |
| 10 | + NUGETTOKEN: ${{ secrets.NUGET_TOKEN }} |
| 11 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/master/MultiProjectRepository |
| 13 | + |
| 14 | +jobs: |
| 15 | + testAndDeploy: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v1 |
| 19 | + with: |
| 20 | + submodules: true |
| 21 | + - name: Test |
| 22 | + run: dotnet test -c Release -f netcoreapp3.1 |
| 23 | + - name: Generate PDF with CSharp code |
| 24 | + if: github.event_name == 'push' |
| 25 | + run: | |
| 26 | + export REPOSITORY_NAME=$(basename ${{ github.repository }}) |
| 27 | + wget "$SCRIPTS_BASE_URL/format-csharp-files.py" |
| 28 | + wget "$SCRIPTS_BASE_URL/format-csharp-document.sh" |
| 29 | + wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh" |
| 30 | + bash ./generate-csharp-pdf.sh |
| 31 | + - name: Publish CSharp documentation to gh-pages branch |
| 32 | + if: github.event_name == 'push' |
| 33 | + run: | |
| 34 | + export REPOSITORY_NAME=$(basename ${{ github.repository }}) |
| 35 | + wget "$SCRIPTS_BASE_URL/docfx.json" |
| 36 | + wget "$SCRIPTS_BASE_URL/filter.yml" |
| 37 | + wget "$SCRIPTS_BASE_URL/toc.yml" |
| 38 | + wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh" |
| 39 | + bash ./publish-csharp-docs.sh |
| 40 | + - name: Read CSharp project information |
| 41 | + if: github.event_name == 'push' |
| 42 | + run: | |
| 43 | + export REPOSITORY_NAME=$(basename ${{ github.repository }}) |
| 44 | + wget "$SCRIPTS_BASE_URL/read_csharp_package_info.sh" |
| 45 | + bash ./read_csharp_package_info.sh |
| 46 | + - name: Publish CSharp NuGet package |
| 47 | + if: github.event_name == 'push' |
| 48 | + run: | |
| 49 | + export REPOSITORY_NAME=$(basename ${{ github.repository }}) |
| 50 | + wget "$SCRIPTS_BASE_URL/push-csharp-nuget.sh" |
| 51 | + bash ./push-csharp-nuget.sh |
| 52 | + - name: Publish release |
| 53 | + if: github.event_name == 'push' |
| 54 | + run: | |
| 55 | + export REPOSITORY_NAME=$(basename ${{ github.repository }}) |
| 56 | + wget "$SCRIPTS_BASE_URL/publish-release.sh" |
| 57 | + bash ./publish-release.sh |
| 58 | + pushCSharpNuGetToGitHubPackageRegistry: |
| 59 | + needs: testAndDeploy |
| 60 | + if: github.event_name == 'push' |
| 61 | + runs-on: windows-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v1 |
| 64 | + with: |
| 65 | + submodules: true |
| 66 | + - uses: nuget/setup-nuget@v1 |
| 67 | + - name: Publish CSharp NuGet to GitHub Package Registry |
| 68 | + run: | |
| 69 | + dotnet build -c Release |
| 70 | + dotnet pack -c Release |
| 71 | + nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/linksplatform/index.json" -UserName linksplatform -Password ${{ secrets.GITHUB_TOKEN }} |
| 72 | + nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate |
0 commit comments