From ab714466dbb0da576adbe626b697337aa11322e6 Mon Sep 17 00:00:00 2001 From: Nelson Parente Date: Mon, 21 Dec 2020 11:19:20 +0000 Subject: [PATCH] ci: update ci/cd workflows (#6) --- .github/workflows/{branches.yml => build.yml} | 14 ++++++---- .github/workflows/{master.yml => publish.yml} | 28 +++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) rename .github/workflows/{branches.yml => build.yml} (70%) rename .github/workflows/{master.yml => publish.yml} (58%) diff --git a/.github/workflows/branches.yml b/.github/workflows/build.yml similarity index 70% rename from .github/workflows/branches.yml rename to .github/workflows/build.yml index 511c1c6..9daf529 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ -name: Build Branch +name: Build on: + pull_request: + push: - branches: - - '**' - - '!master' + branches: [ master ] jobs: build: @@ -13,13 +13,17 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: '2.1' + - name: Install dependencies run: dotnet restore ./IdentityServer4.Contrib.TokenExchange.sln + - name: Build - run: dotnet pack ./IdentityServer4.Contrib.TokenExchange.sln -c Release /p:VersionPrefix="1.0" -o ./drop --include-source --include-symbols + run: dotnet build ./IdentityServer4.Contrib.TokenExchange.sln -c Release + - name: Test run: dotnet test tests/IdentityServer4.Contrib.TokenExchange.Tests/IdentityServer4.Contrib.TokenExchange.Tests.csproj -c Release --no-restore --verbosity normal \ No newline at end of file diff --git a/.github/workflows/master.yml b/.github/workflows/publish.yml similarity index 58% rename from .github/workflows/master.yml rename to .github/workflows/publish.yml index 424c96b..588d5dd 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/publish.yml @@ -1,27 +1,33 @@ -name: Build Master +name: Publish on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + release: + types: [published] jobs: - build: - + release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: '2.1' + - name: Install dependencies run: dotnet restore ./IdentityServer4.Contrib.TokenExchange.sln - - name: Build - run: dotnet pack ./IdentityServer4.Contrib.TokenExchange.sln -c Release /p:VersionPrefix="1.0" -o ./drop --include-source --include-symbols + - name: Test run: dotnet test tests/IdentityServer4.Contrib.TokenExchange.Tests/IdentityServer4.Contrib.TokenExchange.Tests.csproj -c Release --no-restore --verbosity normal - # - name: push to nuget - # run: dotnet nuget push ./drop/*.nupkg -k ${{ secrets.nuget_secret }} -s https://api.nuget.org/v3/index.json --skip-duplicate \ No newline at end of file + + - name: Pack + run: dotnet pack ./IdentityServer4.Contrib.TokenExchange.sln -c Release /p:Version=${{ github.event.release.tag_name }} -o ./drop + + + - name: Publish + run: dotnet nuget push ./src/**/drop/*.nupkg -k ${{ secrets.NUGET_PUBLISH_KEY }} -s https://api.nuget.org/v3/index.json + + - name: Print Version + run: echo ${{ github.event.release.tag_name }}