-
-
Notifications
You must be signed in to change notification settings - Fork 8
192 lines (181 loc) · 7.28 KB
/
dotnet.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Build and Release dotNet
#on: [push]
on:
push:
paths-ignore:
- '*.md'
- '.github/**'
- '*.yaml'
- '*.png'
- 'LICENSE'
jobs:
release-project:
name: Release application to GitHub
strategy:
matrix:
kind: [ 'amd64', 'arm64', 'armv7' ]
include:
- kind: amd64
target: linux-amd64
release_name: "iGotify-Notification-Service-amd64"
- kind: arm64
target: linux-arm64
release_name: "iGotify-Notification-Service-arm64"
- kind: armv7
target: linux-arm
release_name: "iGotify-Notification-Service-arm"
runs-on: ubuntu-latest
needs: build-project
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Binaries
uses: actions/download-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ matrix.release_name }}
- name: Archive binaries
if: startsWith(github.ref, 'refs/tags/v')
uses: thedoctor0/zip-release@master
with:
filename: ${{ matrix.release_name }}.zip
path: ${{ matrix.release_name }}
- name: Get latest Tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: Get version informations
id: infos
run: |
versionGit=${{ steps.get-latest-tag.outputs.tag }}
versionProject=v$(grep '<Version>' 'iGotify Notification Assist.csproj' | cut -d '>' -f2 | cut -d '<' -f1 | xargs)
if [ "$versionGit" != "$versionProject" -a $(git tag | grep -c "$versionProject") -eq 0 ]; then
echo "version=$versionProject" >> $GITHUB_OUTPUT
echo "createtag=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "version=$versionGit" >> $GITHUB_OUTPUT
echo "createtag=false" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: steps.infos.outputs.createtag == 'true'
id: create-new-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }}
with:
tag_name: ${{ steps.infos.outputs.version }}
release_name: Release ${{ steps.infos.outputs.version }}
- name: Get Release URL
if: startsWith(github.ref, 'refs/tags/v')
id: get-release-url
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }}
- name: Upload asset to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }}
with:
upload_url: ${{ steps.get-release-url.outputs.upload_url }}
asset_path: ./${{ matrix.release_name }}.zip
asset_name: ${{ matrix.release_name }}-${{ steps.infos.outputs.version }}.zip
asset_content_type: application/zip
- name: Gotify Notification SUCCESS
if: success()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[RELEASE] Create & Upload'
notification_message: 'Release ${{ steps.infos.outputs.version }} successfully created and binaries uploaded.'
notification_priority: 0
- name: Gotify Notification FAILED
if: failure()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[RELEASE] Create & Upload'
notification_message: 'Release ${{ steps.infos.outputs.version }} failed and binaries not uploaded.'
notification_priority: 9
- name: Gotify Notification CANCELLED
if: cancelled()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[RELEASE] Create & Upload'
notification_message: 'Release ${{ steps.infos.outputs.version }} cancelled by user and binaries not uploaded.'
notification_priority: 5
build-project:
#if: github.event.pull_request.merged == true
name: Build dotNet
strategy:
matrix:
dotnet-version: [ '8.x' ]
kind: [ 'amd64', 'arm64', 'armv7' ]
include:
- kind: amd64
target: linux-amd64
release_name: "iGotify-Notification-Service-amd64"
- kind: arm64
target: linux-arm64
release_name: "iGotify-Notification-Service-arm64"
- kind: armv7
target: linux-arm
release_name: "iGotify-Notification-Service-arm"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Display dotnet version
run: dotnet --version
- name: dotNet Restore
run: dotnet restore "./iGotify Notification Assist.csproj" --runtime ${{ matrix.target }}
- name: dotNet Build
run: dotnet build "./iGotify Notification Assist.csproj" --runtime ${{ matrix.target }} -o "./${{ matrix.release_name }}/build"
- name: dotNet Publish
run: dotnet publish "./iGotify Notification Assist.csproj" -c Release --runtime ${{ matrix.target }} -o "./${{ matrix.release_name }}/publish"
# - name: Upload coverage reports to Codecov
# uses: codecov/[email protected]
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# slug: androidseb25/iGotify-Notification-Assistent
- name: Upload Binaries ${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: "./${{ matrix.release_name }}/publish"
- name: Gotify Notification SUCCESS
if: success()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[DOTNET] Build & Upload Artifacts'
notification_message: 'DotNet build successfully on target: ${{ matrix.target }}.\nArtifact uploaded.'
notification_priority: 0
- name: Gotify Notification FAILED
if: failure()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[DOTNET] Build & Upload Artifacts'
notification_message: 'DotNet build failed on target: ${{ matrix.target }}.\nArtifact not uploaded.'
notification_priority: 9
- name: Gotify Notification CANCELLED
if: cancelled()
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.API_BASE }}
gotify_app_token: ${{ secrets.API_TOKEN }}
notification_title: '[DOTNET] Build & Upload Artifacts'
notification_message: 'DotNet build cancelled by user on target: ${{ matrix.target }}.\nArtifact not uploaded.'
notification_priority: 5