-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (62 loc) · 2.48 KB
/
build-test-publish.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: build-test-publish
on: [workflow_dispatch]
jobs:
build-test-package:
env:
BUILD_CONFIG: 'Release'
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
if: github.ref == 'refs/heads/main'
steps:
# install GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
# check out code
- name: 'Checkout code'
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Determine Version
id: gitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: ./.github/gitversion.yml
# install dotnet
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'
- name: restore dependencies
run: dotnet restore
working-directory: src/Explore.Cli
- name: Build CLI
run: dotnet build --configuration $BUILD_CONFIG /p:Version=${{ steps.gitversion.outputs.AssemblySemVer }} /p:AssemblyVersion=${{ steps.gitversion.outputs.AssemblySemVer }} /p:InformationalVersion=${{ steps.gitversion.outputs.InformationalVersion }}
working-directory: src/Explore.Cli
- name: Run tests
run: |
dotnet restore
dotnet test
working-directory: test/Explore.Cli.Tests
- name: Create Package
run: dotnet pack --configuration $BUILD_CONFIG -o:package /p:PackageVersion=${{ steps.gitVersion.outputs.assemblySemVer }}
working-directory: src/Explore.Cli
#- name: Push package to GitHub registry
# run: |
# dotnet nuget add source --username smartbear-devrel --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/smartbear-devrel/index.json"
# dotnet nuget push ./package/*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
# working-directory: src/Explore.Cli
- name: Setup NuGet
uses: NuGet/[email protected]
- name: setup mono
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install mono
- name: Publish to Nuget
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey $NUGET_API_KEY
working-directory: src/Explore.Cli