-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (90 loc) · 3.62 KB
/
build.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
name: Build
on:
push:
branches:
- '**'
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
# Publish
- name: Define MSBuild properties
run: echo "MSBUILD_PROPS=-p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:InvariantGlobalization=true" >> $GITHUB_ENV
- name: Publish framework-dependent
run: |
dotnet publish CubicBot.Telegram -c Release --no-restore
- name: Publish self-contained for Linux ARM64
if: matrix.os == 'ubuntu-latest'
run: |
dotnet publish CubicBot.Telegram -c Release $MSBUILD_PROPS -r linux-arm64 --self-contained
- name: Publish self-contained for Linux x64
if: matrix.os == 'ubuntu-latest'
run: |
dotnet publish CubicBot.Telegram -c Release $MSBUILD_PROPS -r linux-x64 --self-contained
- name: Publish self-contained for Windows ARM64
if: matrix.os == 'windows-2022'
run: |
dotnet publish CubicBot.Telegram -c Release $MSBUILD_PROPS -r win-arm64 --self-contained
- name: Publish self-contained for Windows x64
if: matrix.os == 'windows-2022'
run: |
dotnet publish CubicBot.Telegram -c Release $MSBUILD_PROPS -r win-x64 --self-contained
# Upload CubicBot.Telegram
- name: Upload CubicBot.Telegram artifacts for Linux ARM64
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-linux-arm64
path: CubicBot.Telegram/bin/Release/net7.0/linux-arm64/publish/
- name: Upload CubicBot.Telegram artifacts for Linux x64
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-linux-x64
path: CubicBot.Telegram/bin/Release/net7.0/linux-x64/publish/
- name: Upload CubicBot.Telegram artifacts for Linux framework-dependent
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-linux
path: CubicBot.Telegram/bin/Release/net7.0/publish/
- name: Upload CubicBot.Telegram artifacts for Windows ARM64
if: matrix.os == 'windows-2022'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-windows-arm64
path: CubicBot.Telegram/bin/Release/net7.0/win-arm64/publish/
- name: Upload CubicBot.Telegram artifacts for Windows x64
if: matrix.os == 'windows-2022'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-windows-x64
path: CubicBot.Telegram/bin/Release/net7.0/win-x64/publish/
- name: Upload CubicBot.Telegram artifacts for Windows framework-dependent
if: matrix.os == 'windows-2022'
uses: actions/upload-artifact@v4
with:
name: cubic-bot-telegram-${{ github.sha }}-windows
path: CubicBot.Telegram/bin/Release/net7.0/publish/