1
+ name : .NET
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - pre-v*
7
+
8
+ jobs :
9
+ build :
10
+ name : Build And Publish
11
+ runs-on : ubuntu-latest
12
+ defaults :
13
+ run :
14
+ working-directory : ./src
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - name : Setup .NET
18
+ uses : actions/setup-dotnet@v4
19
+ with :
20
+ dotnet-version : 6.0.x
21
+ - name : Publish for Linux-x64
22
+ run : dotnet publish -c Release -r linux-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -p:PublishReadyToRun=true -o app/linux-x64
23
+ - name : Publish for Windows-x64
24
+ run : dotnet publish -c Release -r win-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -p:PublishReadyToRun=true -o app/win-x64
25
+ - name : Upload artifacts
26
+ uses : actions/upload-artifact@v3
27
+ with :
28
+ name : app
29
+ if-no-files-found : error
30
+ path : ${{ github.workspace }}/src/app
31
+
32
+ create_release :
33
+ name : Create Release
34
+ needs : build
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - name : Download artifact
38
+ uses : actions/download-artifact@v3
39
+ with :
40
+ name : app
41
+ path : app
42
+
43
+ - name : Zip artifact
44
+ run : |
45
+ cd app
46
+ mv linux-x64/appsettings.Example.json linux-x64/appsettings.json
47
+ zip -r linux-x64.zip linux-x64/*
48
+ mv win-x64/appsettings.Example.json win-x64/appsettings.json
49
+ zip -r win-x64.zip win-x64/*
50
+
51
+ - name : Create Release
52
+ id : create_release
53
+ uses : actions/create-release@v1
54
+ env :
55
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56
+ with :
57
+ tag_name : ${{ github.ref }}
58
+ release_name : Release ${{ github.ref }}
59
+ draft : false
60
+ prerelease : true
61
+
62
+ - name : Upload Release Asset for Linux-x64
63
+ id : upload_linux
64
+ uses : actions/upload-release-asset@v1
65
+ env :
66
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
+ with :
68
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
69
+ asset_path : app/linux-x64.zip
70
+ asset_name : linux-x64.zip
71
+ asset_content_type : application/zip
72
+
73
+ - name : Upload Release Asset for Windows-x64
74
+ id : upload_win
75
+ uses : actions/upload-release-asset@v1
76
+ env :
77
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78
+ with :
79
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
80
+ asset_path : app/win-x64.zip
81
+ asset_name : win-x64.zip
82
+ asset_content_type : application/zip
83
+
84
+ cleanup :
85
+ name : Cleanup
86
+ needs : create_release
87
+ runs-on : ubuntu-latest
88
+ steps :
89
+ - name : Remove artifacts
90
+ uses : geekyeggo/delete-artifact@v2
91
+ with :
92
+ name : " *"
0 commit comments