-
Notifications
You must be signed in to change notification settings - Fork 4
123 lines (103 loc) · 3.58 KB
/
dotnet-beta.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: PUBLISH BETA
on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- 'development'
- 'dev/**'
- 'fix/**'
- 'bug/**'
- 'hotfix/**'
- 'feat/**'
- 'feature/**'
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Dotnet Restore
run: dotnet restore ./**.sln
- name: Build Source Projects
run: dotnet build ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
- name: Pack NuGet Packages
run: dotnet pack ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release -o bin/nugetPackages
- name: Find CLZ Output
id: find_clz
run: |
CLZ_FILE=$(find ./source/ -name "*.clz" | head -n 1)
echo "CLZ_PATH=${CLZ_FILE}" >> $GITHUB_OUTPUT
echo $CLZ_PATH
echo done
- name: Copy CLZ if Found
run: |
if [ -f ${{ steps.find_clz.outputs.CLZ_PATH }} ]; then
cp ${{ steps.find_clz.outputs.CLZ_PATH }} bin/nugetPackages
else
echo "Could not find CLZ."
fi
- name: Copy USH Files
run: |
if [ -f './source/WebLogger.Crestron/Simpl/WebLogger Command.ush' ]; then
cp './source/WebLogger.Crestron/Simpl/WebLogger Command.ush' bin/nugetPackages
else
echo "Could not find Command.ush"
fi
if [ -f './source/WebLogger.Crestron/Simpl/WebLogger Server.ush' ]; then
cp './source/WebLogger.Crestron/Simpl/WebLogger Server.ush' bin/nugetPackages
else
echo "Could not find Command.ush"
fi
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages
release:
if: needs.build.outputs.CommitsSinceVersionSource > 0
runs-on: ubuntu-latest
needs: build
steps:
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages
- name: Create Release
uses: ncipollo/[email protected]
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
body: Released via github actions workflow, see repository README.md
generateReleaseNotes: true
artifacts: "bin/nugetPackages/"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push packages to Nuget
run: |
for file in $(find bin/nugetPackages -type f -name "*.nupkg"); do
echo $file
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done