-
Notifications
You must be signed in to change notification settings - Fork 12
198 lines (183 loc) · 7.23 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
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
193
194
195
196
197
198
name: Release
on:
push:
tags:
- '*'
jobs:
build-windows:
name: Windows
runs-on: windows-2019
env:
MSBUILD_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin"
BOOST_ROOT: C:\thirdparties\boost-1.72.0
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: master
- name: Install OpenSSL
run: choco install openssl
- name: Install Boost
shell: powershell
run: |
$Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe"
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost-installer.exe")
Start-Process -Wait -FilePath "$env:TEMP\boost-installer.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$env:BOOST_ROOT"
- name: Build
shell: powershell
id: build
run: |
$env:PATH = "$env:PATH;$env:MSBUILD_PATH"
$build_folder = "build"
$krb_ver = "${{ github.ref }}" -replace 'refs/tags/'
$release_name = "Karbo-cli-win64-${krb_ver}"
mkdir "$build_folder"
cd "$build_folder"
cmake -G "Visual Studio 16 2019" -A x64 -DBOOST_ROOT="$env:BOOST_ROOT" -DBOOST_INCLUDE_DIRS="$env:BOOST_ROOT/include" ..
MSBuild Karbo.sln /p:Configuration=Release /m
cd src\Release
Compress-Archive -Path *.exe -DestinationPath "$release_name.zip"
$sha256 = (Get-FileHash "$release_name.zip").Hash
$asset_path = "./$build_folder/src/Release/$release_name.zip"
echo "sha256=${sha256}" >> $env:GITHUB_OUTPUT
echo "release_name=${release_name}.zip" >> $env:GITHUB_OUTPUT
echo "asset_path=${asset_path}" >> $env:GITHUB_OUTPUT
echo "krb_ver=${krb_ver}" >> $env:GITHUB_OUTPUT
- name: Create Release
uses: softprops/[email protected]
with:
files: ${{ steps.build.outputs.asset_path }}
name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }}
body: |
**${{ steps.build.outputs.release_name }}**
${{ steps.build.outputs.sha256 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-macos:
name: macOS
runs-on: macos-11
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: master
- name: Build
id: build
run: |
build_folder="build/"
krb_ver=$(echo ${{ github.ref }} | sed 's|refs/tags/||')
release_name="Karbo-cli-macOS-${krb_ver}"
brew install --force boost gcc openssl
brew link boost --force
mkdir "$build_folder"
cd "$build_folder"
cmake -DARCH=default -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" ..
make
mkdir "$release_name"
exeFiles=()
for f in src/*; do [[ -x $f && -f $f ]] && strip "$f" && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
cp "${exeFiles[@]}" "$release_name/"
zip -r "$release_name".zip "$release_name"
sha256=$(shasum -a 256 "$release_name".zip | awk '{print toupper($1)}')
asset_path="./$build_folder$release_name.zip"
echo "sha256=${sha256}" >> $GITHUB_OUTPUT
echo "release_name=${release_name}.zip" >> $GITHUB_OUTPUT
echo "asset_path=${asset_path}" >> $GITHUB_OUTPUT
echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/[email protected]
with:
files: ${{ steps.build.outputs.asset_path }}
name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }}
body: |
**${{ steps.build.outputs.release_name }}**
${{ steps.build.outputs.sha256 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-ubuntu22:
name: Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: master
- name: Build
id: build
run: |
sudo apt update
sudo apt install -y libboost-all-dev libssl-dev
build_folder="build/release"
krb_ver=$(echo "$GITHUB_REF" | sed 's|refs/tags/||')
release_name="Karbo-cli-ubuntu22.04-${krb_ver}"
mkdir -p "$build_folder"
cd "$build_folder"
cmake -D ARCH=default -D CMAKE_BUILD_TYPE=Release -D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=true ../..
make
cd src
exeFiles=()
for f in ./*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
tar -czf "$release_name".tar.gz "${exeFiles[@]}"
mv "$release_name".tar.gz ../
cd ..
sha256=$(shasum -a 256 "$release_name".tar.gz | awk '{print toupper($1)}')
asset_path="./$build_folder/$release_name.tar.gz"
echo "sha256=${sha256}" >> $GITHUB_OUTPUT
echo "release_name=${release_name}.tar.gz" >> $GITHUB_OUTPUT
echo "asset_path=${asset_path}" >> $GITHUB_OUTPUT
echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/[email protected]
with:
files: ${{ steps.build.outputs.asset_path }}
name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }}
body: |
**${{ steps.build.outputs.release_name }}**
${{ steps.build.outputs.sha256 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-ubuntu20:
name: Ubuntu 20.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: master
- name: Build
id: build
run: |
sudo apt update
sudo apt install -y libboost-all-dev libssl-dev
build_folder="build/release"
krb_ver=$(echo "$GITHUB_REF" | sed 's|refs/tags/||')
release_name="Karbo-cli-ubuntu20.04-${krb_ver}"
mkdir -p "$build_folder"
cd "$build_folder"
cmake -D ARCH=default -D CMAKE_BUILD_TYPE=Release -D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=true ../..
make
cd src
exeFiles=()
for f in ./*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
tar -czf "$release_name".tar.gz "${exeFiles[@]}"
mv "$release_name".tar.gz ../
cd ..
sha256=$(shasum -a 256 "$release_name".tar.gz | awk '{print toupper($1)}')
asset_path="./$build_folder/$release_name.tar.gz"
echo "sha256=${sha256}" >> $GITHUB_OUTPUT
echo "release_name=${release_name}.tar.gz" >> $GITHUB_OUTPUT
echo "asset_path=${asset_path}" >> $GITHUB_OUTPUT
echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/[email protected]
with:
files: ${{ steps.build.outputs.asset_path }}
name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }}
body: |
**${{ steps.build.outputs.release_name }}**
${{ steps.build.outputs.sha256 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}