-
Notifications
You must be signed in to change notification settings - Fork 4
129 lines (114 loc) · 5.77 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
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
name: Release
on:
push:
tags:
- 'v*'
jobs:
publish_upload:
name: Publish and upload
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9'
- name: Restore dependencies
run: dotnet restore
# 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.App -c Release --no-restore
dotnet publish CubicBot.Telegram.Tool -c Release --no-restore
- name: Publish self-contained for Linux ARM64
if: matrix.os == 'ubuntu-latest'
run: |
dotnet publish CubicBot.Telegram.App -c Release $MSBUILD_PROPS -r linux-arm64 --self-contained
dotnet publish CubicBot.Telegram.Tool -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.App -c Release $MSBUILD_PROPS -r linux-x64 --self-contained
dotnet publish CubicBot.Telegram.Tool -c Release $MSBUILD_PROPS -r linux-x64 --self-contained
- name: Publish self-contained for Windows ARM64
if: matrix.os == 'windows-latest'
run: |
dotnet publish CubicBot.Telegram.App -c Release $MSBUILD_PROPS -r win-arm64 --self-contained
dotnet publish CubicBot.Telegram.Tool -c Release $MSBUILD_PROPS -r win-arm64 --self-contained
- name: Publish self-contained for Windows x64
if: matrix.os == 'windows-latest'
run: |
dotnet publish CubicBot.Telegram.App -c Release $MSBUILD_PROPS -r win-x64 --self-contained
dotnet publish CubicBot.Telegram.Tool -c Release $MSBUILD_PROPS -r win-x64 --self-contained
# Package
- name: Package for Linux
if: matrix.os == 'ubuntu-latest'
env:
ZSTD_CLEVEL: 19
ZSTD_NBTHREADS: 2
run: |
# CubicBot.Telegram.App
cd CubicBot.Telegram.App/bin/Release/net9.0/publish
tar -acf ../cubic-bot-telegram-app-${{ github.ref_name }}-linux.tar.zst .
cd ../linux-arm64/publish
tar -acf ../../cubic-bot-telegram-app-${{ github.ref_name }}-linux-arm64.tar.zst .
cd ../../linux-x64/publish
tar -acf ../../cubic-bot-telegram-app-${{ github.ref_name }}-linux-x64.tar.zst .
# CubicBot.Telegram.Tool
cd ../../../../../../CubicBot.Telegram.Tool/bin/Release/net9.0/publish
tar -acf ../cubic-bot-telegram-tool-${{ github.ref_name }}-linux.tar.zst .
cd ../linux-arm64/publish
tar -acf ../../cubic-bot-telegram-tool-${{ github.ref_name }}-linux-arm64.tar.zst .
cd ../../linux-x64/publish
tar -acf ../../cubic-bot-telegram-tool-${{ github.ref_name }}-linux-x64.tar.zst .
- name: Package for Windows
if: matrix.os == 'windows-latest'
run: |
# CubicBot.Telegram.App
cd CubicBot.Telegram.App/bin/Release/net9.0/publish
7z a -tzip -mx=9 -mfb=128 ../cubic-bot-telegram-app-${{ github.ref_name }}-windows.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../cubic-bot-telegram-app-${{ github.ref_name }}-windows.7z .
cd ../win-arm64/publish
7z a -tzip -mx=9 -mfb=128 ../../cubic-bot-telegram-app-${{ github.ref_name }}-windows-arm64.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../../cubic-bot-telegram-app-${{ github.ref_name }}-windows-arm64.7z .
cd ../../win-x64/publish
7z a -tzip -mx=9 -mfb=128 ../../cubic-bot-telegram-app-${{ github.ref_name }}-windows-x64.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../../cubic-bot-telegram-app-${{ github.ref_name }}-windows-x64.7z .
# CubicBot.Telegram.Tool
cd ../../../../../../CubicBot.Telegram.Tool/bin/Release/net9.0/publish
7z a -tzip -mx=9 -mfb=128 ../cubic-bot-telegram-tool-${{ github.ref_name }}-windows.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../cubic-bot-telegram-tool-${{ github.ref_name }}-windows.7z .
cd ../win-arm64/publish
7z a -tzip -mx=9 -mfb=128 ../../cubic-bot-telegram-tool-${{ github.ref_name }}-windows-arm64.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../../cubic-bot-telegram-tool-${{ github.ref_name }}-windows-arm64.7z .
cd ../../win-x64/publish
7z a -tzip -mx=9 -mfb=128 ../../cubic-bot-telegram-tool-${{ github.ref_name }}-windows-x64.zip .
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on ../../cubic-bot-telegram-tool-${{ github.ref_name }}-windows-x64.7z .
# Release
- name: Upload release assets for Linux
uses: svenstaro/upload-release-action@v2
if: matrix.os == 'ubuntu-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CubicBot.Telegram.*/bin/Release/net9.0/*.tar.zst
tag: ${{ github.ref }}
file_glob: true
prerelease: true
- name: Upload release assets for Windows
uses: svenstaro/upload-release-action@v2
if: matrix.os == 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CubicBot.Telegram.*/bin/Release/net9.0/cubic-bot-telegram-*-windows*.*
tag: ${{ github.ref }}
file_glob: true
prerelease: true