Skip to content

Commit 8a7399f

Browse files
author
tznind
committed
Test actually using the template
1 parent e5e98e8 commit 8a7399f

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,43 @@ name: Build and package
33
on: push
44

55
jobs:
6-
package:
6+
build:
77
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
job: [package-template, test-template]
12+
813
steps:
914
- uses: actions/checkout@v3
10-
- name: Build
11-
run: cd templates/basic && dotnet build
12-
- name: Pack
13-
run: dotnet pack
14-
- name: Publish to Nuget
15-
if: contains(github.ref, 'refs/tags/v')
16-
run: dotnet nuget push ./bin/Release/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
1715

16+
- name: Set up .NET
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: '8.x'
20+
21+
- name: Build and Package Template
22+
if: matrix.job == 'package-template'
23+
run: |
24+
cd templates/basic
25+
dotnet build
26+
dotnet pack --output ../../nupkgs
27+
28+
- name: Publish to NuGet
29+
if: matrix.job == 'package-template' && contains(github.ref, 'refs/tags/v')
30+
run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
31+
32+
- name: Test Template Install and Build
33+
if: matrix.job == 'test-template'
34+
run: |
35+
# Install the template locally
36+
dotnet new --install templates/basic
37+
38+
# Create a new project from the template
39+
mkdir testapp
40+
cd testapp
41+
dotnet new tui -n myproj
42+
cd myproj
43+
44+
# Build the generated project
45+
dotnet build

0 commit comments

Comments
 (0)