Skip to content

Commit ef79459

Browse files
committed
Used re-usable workflows
1 parent 21591e0 commit ef79459

File tree

3 files changed

+28
-76
lines changed

3 files changed

+28
-76
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,12 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- '**' # Ignores pushes of tags
57
pull_request:
68
workflow_dispatch:
79

810
jobs:
911
build:
10-
runs-on: windows-latest # Use Ubuntu in v5.0
11-
12-
env:
13-
DOTNET_NOLOGO: true
14-
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
15-
16-
steps:
17-
- uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0 # all
20-
21-
- name: Setup .NET 2.0 # Remove in v5.0
22-
uses: actions/setup-dotnet@v1
23-
with:
24-
dotnet-version: 2.0.x
25-
26-
- name: Setup .NET 8.0
27-
uses: actions/setup-dotnet@v1
28-
with:
29-
dotnet-version: 8.0.x
30-
31-
- name: Install NuGet
32-
uses: NuGet/[email protected]
33-
34-
- name: Install GitVersion
35-
uses: gittools/actions/gitversion/setup@v0
36-
with:
37-
versionSpec: '5.x'
38-
39-
- name: Run GitVersion
40-
id: gitversion
41-
uses: gittools/actions/gitversion/execute@v0
42-
43-
- name: Display SemVer
44-
run: |
45-
echo "SemVer: $env:GitVersion_SemVer"
46-
47-
- name: Add DbUp NuGet Source
48-
run: dotnet nuget add source --name DbUp --username DbUp --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://nuget.pkg.github.com/DbUp/index.json
49-
50-
- name: Restore
51-
run: dotnet restore
52-
working-directory: src
53-
54-
- name: Build
55-
run: dotnet build -c Release --no-restore /p:Version=$env:GitVersion_SemVer
56-
working-directory: src
57-
58-
- name: Test
59-
run: dotnet test --no-build -c Release --logger trx --logger "console;verbosity=detailed" --results-directory ../artifacts
60-
working-directory: src
61-
62-
- name: Pack
63-
run: dotnet pack --no-build -c Release -o ../artifacts /p:Version=$env:GitVersion_SemVer
64-
working-directory: src
65-
66-
- name: Pack placeholder dbup package
67-
run: nuget pack ./dbup/dbup.nuspec -OutputDirectory ../artifacts -Version $env:GitVersion_SemVer
68-
working-directory: src
69-
70-
- name: Push NuGet packages to GitHub Packages ⬆️
71-
working-directory: artifacts
72-
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json"
73-
74-
- name: Push NuGet packages to NuGet ⬆️
75-
if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }}
76-
working-directory: artifacts
77-
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json
78-
79-
- name: Test Report 🧪
80-
uses: dorny/test-reporter@v1
81-
if: ${{ always() }}
82-
with:
83-
name: Tests
84-
path: artifacts/*.trx
85-
reporter: dotnet-trx
12+
name: Build
13+
uses: DbUp/Universe/.github/workflows/build.yml@main
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Publish DbUp Packages to NuGet
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
name: Publish Package
11+
uses: DbUp/Universe/.github/workflows/publish-release.yml@main
12+
secrets: inherit

.github/workflows/test-report.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test Report
2+
run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}
3+
4+
on:
5+
workflow_run:
6+
workflows: ["CI", "build"]
7+
types: [completed]
8+
9+
jobs:
10+
report:
11+
name: Test Report 🧪
12+
uses: DbUp/Universe/.github/workflows/test-report.yml@main

0 commit comments

Comments
 (0)