-
Notifications
You must be signed in to change notification settings - Fork 3
221 lines (212 loc) · 7.37 KB
/
Copy pathdxapi-release.yml
File metadata and controls
221 lines (212 loc) · 7.37 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: Release dxapi
on:
push:
branches: [release-*]
jobs:
prepare-release:
name: Prepare
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Prepare branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b workflow-$GITHUB_RUN_ID
versionSnapshot=`grep 'version=' project.properties | sed 's/version=\([^-]*\)/\1/'`
versionRelease=`echo $versionSnapshot | sed 's/\([^-]*\)-SNAPSHOT/\1/'`
versionSnapshotNext=`echo $versionSnapshot | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e'`
echo "$versionSnapshot -> $versionRelease -> $versionSnapshotNext"
sed -i "s/version=$versionSnapshot/version=$versionRelease/" project.properties
git commit -am "[skip-ci] Generate release version"
sed -i "s/version=$versionRelease/version=$versionSnapshotNext/" project.properties
git commit -am "[skip-ci] Generate next snapshot version"
git push origin HEAD
build-nix:
needs: [prepare-release]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
include:
- os: macos-latest
env_os: MACOS
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Build Dxapi
run: make -C .
env:
CC: clang
OS: ${{ matrix.env_os }}
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: dxapi-${{ matrix.os }}
path: |
include/native/**/*.h
bin/libdxapi-x64.a
build-windows:
needs: [prepare-release]
runs-on: windows-2019
strategy:
matrix:
conf: [debug, release]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Use MSBuild
uses: microsoft/setup-msbuild@v1.0.2
- name: Build Solution
run: msbuild dxapi.sln /p:configuration=${{ matrix.conf }} /p:platform=x64 /t:rebuild
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: dxapi-windows-${{ matrix.conf }}
path: |
include/native/**/*.h
bin/dxapi-x64.lib
bin/dxapi-x64d.lib
bin/dxapi-x64d.pdb
release:
name: Release
needs: [build-nix, build-windows]
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Release branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1
export VERSIONRELEASE=$(grep 'version=' project.properties | sed 's/version=\([^-]*\)/\1/')
echo $VERSIONRELEASE >> ./version.txt
git tag $VERSIONRELEASE
git push origin $VERSIONRELEASE
git push origin origin/workflow-$GITHUB_RUN_ID:$GITHUB_REF
- name: Version artifact
uses: actions/upload-artifact@v2
with:
name: version-file
path: ./version.txt
package-windows:
name: Package Windows
needs: [release]
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download dxapi-windows artifacts
uses: actions/download-artifact@v2
with:
name: dxapi-windows-debug
- name: Download dxapi-windows artifacts
uses: actions/download-artifact@v2
with:
name: dxapi-windows-release
- name: Download version-file artifacts
uses: actions/download-artifact@v2
with:
name: version-file
- name: Using Nuget
uses: nuget/setup-nuget@v1
- name: Build Nuget package
run: |
$Version = get-content .\version.txt
echo $Version
nuget pack dxapi.nuspec -properties version=$Version
nuget push EPAM.Deltix.Timebase.Api.Native.$Version.nupkg -Source $Env:NUGET_URL -ApiKey $Env:NUGET_API_KEY
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NUGET_URL: https://api.nuget.org/v3/index.json
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: dxapi-nuget-package
path:
EPAM.Deltix.Timebase.Api.Native.*.nupkg
package-nix:
name: Package Nix
needs: [release]
runs-on: ${{ matrix.os }}
outputs:
tag: ${{ steps.tag.outputs.tag }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download dxapi-nix artifacts
uses: actions/download-artifact@v2
with:
name: dxapi-${{ matrix.os }}
- name: Download version-file artifacts
uses: actions/download-artifact@v2
with:
name: version-file
- name: Build Linux Packages
if: ${{ matrix.os == 'ubuntu-20.04' }}
id: tag
run: |
export VERSION=$(cat version.txt)
echo ::set-output name=tag::$VERSION
sed -i 's/version: "v6.0.28"/version: "$VERSION"/g' dxapi.yaml
curl -OL https://github.com/goreleaser/nfpm/releases/download/v2.5.1/nfpm_amd64.deb
sudo dpkg -i nfpm_amd64.deb
nfpm package -p deb -f dxapi.yaml
nfpm package -p rpm -f dxapi.yaml
- name: Build MacOS Packages
if: ${{ matrix.os == 'macos-latest' }}
run: |
export VERSION=$(cat version.txt)
sudo mkdir /Library/Developer/CommandLineTools/usr/lib/dxapi
gem install --no-document fpm
fpm -s dir -t osxpkg --vendor EPAM --description “TimebaseClientC++Api-platformToolsetv142” --url “https://github.com/epam/TimeBaseClientCpp” --license “Apache-2.0” -n dxapi -v $VERSION -a x86_64 \
$GITHUB_WORKSPACE/bin/=/Library/Developer/CommandLineTools/usr/lib/dxapi/ \
$GITHUB_WORKSPACE/include/native/=/Library/Developer/CommandLineTools/usr/include/
- name: Archive Packages
uses: actions/upload-artifact@v2
with:
name: dxapi-nix-packages
path: |
dxapi*.deb
dxapi*.rpm
dxapi*.pkg
publish:
name: Publish
needs: [package-nix, package-windows]
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download dxapi-nix-packages
uses: actions/download-artifact@v2
with:
name: dxapi-nix-packages
- name: Download dxapi-nuget-package
uses: actions/download-artifact@v2
with:
name: dxapi-nuget-package
- name: Publish
uses: ncipollo/release-action@v1
with:
artifacts: "dxapi*.pkg, dxapi*.deb, dxapi*.rpm, EPAM.Deltix.Timebase.Api.Native.*.nupkg, LICENSE"
prerelease: true
tag: ${{ needs.package-nix.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
cleanup-release:
name: Cleanup
needs: [publish]
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cleanup
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git push origin --delete workflow-$GITHUB_RUN_ID || true