-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (46 loc) · 1.69 KB
/
net60-aspnetcore-cached.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# https://devblogs.microsoft.com/dotnet/dotnet-loves-github-actions/
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net#caching-dependencies
name: ASP.NET Core 6.0 (Cached)
on:
push:
branches: [ main ]
paths:
- 'dotnet/net6.0/**'
workflow_dispatch:
env:
DOTNET_VERSION: '6.0.x'
SOURCE_CODE_PATH: 'razorpageapp/razorpageapp.csproj'
BUILD_CONFIGURATION: Release
jobs:
build-aspnetcore6-cached:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'dotnet/net6.0'
steps:
- uses: actions/checkout@v2
- name: Setup .NET
id: setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- run: echo '${{ steps.setup.outputs.dotnet-version }}'
- name: Cache nuget packages
id: cache-nuget
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
${{ runner.os }}-
- name: List the state of nuget packages
if: ${{ steps.cache-nuget.outputs.cache-hit != 'true' }}
continue-on-error: true
run: dotnet nuget locals all --list
- name: Restore dependencies
run: dotnet restore ${{ env.SOURCE_CODE_PATH }}
- name: Build
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOURCE_CODE_PATH }}
- name: Publish
run: dotnet publish --no-build --configuration ${{ env.BUILD_CONFIGURATION }} --output ${{ env.DOTNET_ROOT }}/myapp ${{ env.SOURCE_CODE_PATH }}