-
-
Notifications
You must be signed in to change notification settings - Fork 194
206 lines (201 loc) · 6.7 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
199
200
201
202
203
204
205
206
name: release
on:
push:
tags:
- 'v*'
env:
GO_VERSION: 1.23.x
WIX_VERSION: 5.0.0
PYTHON_VERSION: 3.7.9
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Adjust pkg-config prefix
shell: bash
run: |
sed -i 's/C:\/Python37/C:\/hostedtoolcache\/windows\/Python\/3.7.9\/x64/' pkg-config/python-37.pc
- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
release: false
install: >-
base-devel
mingw-w64-x86_64-gcc
mingw-w64-x86_64-openssl
mingw-w64-x86_64-pkg-config
git
automake
libtool
autoconf
- name: Cache yara
uses: actions/cache@v4
id: cache
with:
path: |
**/yara
key: ${{ runner.os }}-yara-${{ hashFiles('**/pkg/yara') }}
restore-keys: |
${{ runner.os }}-yara-${{ hashFiles('**/pkg/yara') }}
- name: Clone yara
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
VERSION: "4.2.x"
run: |
git clone --depth 1 --branch $VERSION https://github.com/VirusTotal/yara.git
- name: Configure yara
if: steps.cache.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
cd yara
autoreconf -fiv
./configure --host=x86_64-w64-mingw32
- name: Install yara
shell: msys2 {0}
run: |
cd yara
make install
- name: Get version
id: get_version
shell: bash
run: |
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c2-)" >> $GITHUB_OUTPUT
- name: Build
shell: bash
run: |
export PATH=/c/msys64/mingw64/bin:$PATH
export PKG_CONFIG_PATH=$(pwd)/pkg-config
export COMMIT=$(echo $GITHUB_SHA | cut -c1-8)
export VERSION=${{ steps.get_version.outputs.VERSION }}
./make.bat rsrc
./make.bat mc
./make.bat
env:
TAGS: kcap,filament,yara,yara_static
- name: Install Wix
shell: bash
run: |
dotnet tool install --global wix --version $WIX_VERSION
- name: Package
shell: bash
run: |
export VERSION=${{ steps.get_version.outputs.VERSION }}
./make.bat pkg
mkdir ./build/msi/signed
- uses: actions/upload-artifact@v4
id: upload-msi
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi
path: "./build/msi/fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi"
- name: Sign MSI
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: "${{ secrets.SIGNPATH_API_TOKEN }}"
organization-id: "${{ secrets.SIGNPATH_ORG_ID }}"
project-slug: "fibratus"
signing-policy-slug: "release-signing"
github-artifact-id: "${{ steps.upload-msi.outputs.artifact-id }}"
wait-for-completion: true
output-artifact-directory: "./build/msi/signed"
- uses: actions/upload-artifact@v4
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi
path: "./build/msi/signed/fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi"
overwrite: true
build-slim:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version
id: get_version
shell: bash
run: |
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c2-)" >> $GITHUB_OUTPUT
- name: Build
shell: bash
run: |
export PATH=/c/msys64/mingw64/bin:$PATH
export COMMIT=$(echo $GITHUB_SHA | cut -c1-8)
export VERSION=${{ steps.get_version.outputs.VERSION }}
./make.bat rsrc
./make.bat mc
./make.bat
- name: Install Wix
shell: bash
run: |
dotnet tool install --global wix --version $WIX_VERSION
- name: Package
shell: bash
run: |
export VERSION=${{ steps.get_version.outputs.VERSION }}
./make.bat pkg-slim
mkdir ./build/msi/signed
- uses: actions/upload-artifact@v4
id: upload-msi
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi
path: "./build/msi/fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi"
- name: Sign MSI
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: "${{ secrets.SIGNPATH_API_TOKEN }}"
organization-id: "${{ secrets.SIGNPATH_ORG_ID }}"
project-slug: "fibratus"
signing-policy-slug: "release-signing"
artifact-configuration-slug: "fibratus-slim"
github-artifact-id: "${{ steps.upload-msi.outputs.artifact-id }}"
wait-for-completion: true
output-artifact-directory: "./build/msi/signed"
- uses: actions/upload-artifact@v4
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi
path: "./build/msi/signed/fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi"
overwrite: true
release:
runs-on: windows-latest
needs:
- build
- build-slim
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get_version
shell: bash
run: |
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c2-)" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi
path: build
- uses: actions/download-artifact@v4
with:
name: fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi
path: build
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
files: |
build/fibratus-${{ steps.get_version.outputs.VERSION }}-amd64.msi
build/fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}