diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1bf1d78..194efc8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -3,6 +3,7 @@ name: dotnet on: push: branches: [master] + tags: ["*"] pull_request: branches: [master] @@ -18,12 +19,12 @@ jobs: with: fetch-depth: 0 - - uses: gittools/actions/gitversion/setup@v0.9.3 + - uses: gittools/actions/gitversion/setup@v0.9.4 with: versionSpec: "5.x" - id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.3 + uses: gittools/actions/gitversion/execute@v0.9.4 - uses: actions/setup-dotnet@v1 with: @@ -55,8 +56,7 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) - - name: NuGet Pack - run: | + - run: | dotnet pack \ --include-source \ --configuration Release \ @@ -64,9 +64,66 @@ jobs: --no-restore \ -p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \ src/json-ld.net/json-ld.net.csproj \ - --output nugets/ + --output ${{ github.workspace }}/nugets/ - uses: actions/upload-artifact@v2 with: name: nugets path: nugets + + nuget-push-dev: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') != true + needs: build + + steps: + - uses: actions/download-artifact@v2 + with: + name: nugets + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1 + source-url: https://nuget.pkg.github.com/linked-data-dotnet/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} + + nuget-push-prod: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: build + + steps: + - uses: actions/download-artifact@v2 + with: + name: nugets + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.1.401 + source-url: https://api.nuget.org/v3/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} + + - run: dotnet nuget push nugets/*.nupkg --skip-duplicate + + release-artifacts: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/download-artifact@v1 + with: + name: nugets + + - name: Upload to stable release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: nugets + asset_name: json-ld.net + tag: ${{ github.ref }} + overwrite: true