-
Notifications
You must be signed in to change notification settings - Fork 14
81 lines (68 loc) · 3.17 KB
/
release.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
name: Deploy to NuGet
on:
push:
branches:
- master
jobs:
build-and-test:
name: Build & Test
uses: CropperBlazor/Cropper.Blazor/.github/workflows/build-test-template.yml@dev
secrets: inherit
with:
configuration: 'Release'
publish-coverage: true
deploy-to-nuget:
name: Deploy to NuGet
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore dependencies
run: dotnet restore
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Restore dotnet tool
run: dotnet tool restore
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Build
run: dotnet build -c Release --no-restore
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Pack package
run: dotnet pack -c Release
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Verify file keys in Cropper.Blazor.staticwebassets.runtime.json
run: |
error_messages=""
for net_version in 6.0 7.0 8.0; do
json_path="src/Cropper.Blazor/Cropper.Blazor/bin/Release/net$net_version/Cropper.Blazor.staticwebassets.runtime.json"
if [ -f "$json_path" ]; then
if ! jq -e '.Root.Children["cropperJsInterop.min.js"]' "$json_path" > /dev/null; then
error_messages+="For .NET $net_version: Key 'cropperJsInterop.min.js' does not exist.\n"
fi
if ! jq -e '.Root.Children["cropperJsInterop.js"]' "$json_path" > /dev/null; then
error_messages+="For .NET $net_version: Key 'cropperJsInterop.js' does not exist.\n"
fi
if ! jq -e '.Root.Children["cropper.min.css"]' "$json_path" > /dev/null; then
error_messages+="For .NET $net_version: Key 'cropper.min.css' does not exist.\n"
fi
if ! jq -e '.Root.Children["cropper.min.js"]' "$json_path" > /dev/null; then
error_messages+="For .NET $net_version: Key 'cropper.min.js' does not exist.\n"
fi
else
error_messages+="File $json_path does not exist for .NET $net_version.\n"
fi
done
if [ -n "$error_messages" ]; then
echo -e "$error_messages"
exit 1
else
echo "All keys exist for .NET 6, .NET 7, and .NET 8."
fi
- name: Push to NuGet Gallery
run: dotnet nuget push bin/Release/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Add NuGet repository source
run: dotnet nuget add source --username CropperBlazor --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/CropperBlazor/index.json"
- name: Publish NuGet package to GitHub packages
run: dotnet nuget push bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate
working-directory: src/Cropper.Blazor/Cropper.Blazor