Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

housekeeping: Cache NuGet packages #422

Merged
merged 6 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 45 additions & 27 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Core Desktop
name: Build

on:
push:
Expand All @@ -10,24 +10,13 @@ on:
env:
configuration: Release
productNamespacePrefix: "DynamicData"
validRelease: ${{ contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
source-url: https://api.nuget.org/v3/index.json

jobs:
build:

runs-on: windows-latest

outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:

- name: PR Environment
run: |
echo Release Tag Contained - ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
echo Pull Request - ${{ github.event_name == 'pull_request' }}
echo GitHub Action - ${{ github.event.action == 'closed' }}
echo Pull Request Merged - ${{ github.event.pull_request.merged == true }}

- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -39,14 +28,23 @@ jobs:
dotnet-version: 3.1.x

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true

- name: Restore NuGet Packages
- uses: actions/cache@v1
name: Cache NuGet
id: cache
with:
path: '~/.nuget/packages'
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: NuGet Restore
if: steps.cache.outputs.cache-hit != 'true'
run: dotnet restore
working-directory: src

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.1

Expand All @@ -65,28 +63,48 @@ jobs:
run: reportgenerator -reports:"coverage.*.xml" -targetdir:report-output
working-directory: artifacts/coverage

- name: Generate Coverage Artifacts
uses: actions/upload-artifact@master
with:
name: Coverage
path: artifacts/coverage/report-output

- name: Upload Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
directory: artifacts/coverage

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

release:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Download NuGet Packages
uses: actions/download-artifact@v2
with:
name: nuget

- name: NuGet Push
if: env.validRelease == 'true'
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg

- name: Create Tag
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: changelog
env:
REPO: ${{ github.repository }}

- name: Create Release
uses: actions/create-release@v1
if: env.validRelease == 'true'
run: |
git tag v${{ steps.nbgv.outputs.SemVer2 }} main
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.changelog }}
29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<RepositoryUrl>https://github.com/reactiveui/DynamicData</RepositoryUrl>
<RepositoryType>git</RepositoryType>

<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>

<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
Expand Down
2 changes: 1 addition & 1 deletion src/DynamicData.Benchmarks/DynamicData.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<IsPackable>false</IsPackable>
<NoWarn>;1591;1701;1702;1705;CA1822;CA1001</NoWarn>
Expand Down
Loading