-
Notifications
You must be signed in to change notification settings - Fork 1.7k
151 lines (134 loc) · 4.1 KB
/
build_release.yml
File metadata and controls
151 lines (134 loc) · 4.1 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
name: Packages Build
on:
push:
paths-ignore:
- ".gitignore"
- "docs/**"
- "ChangeLog"
- "CREDITS.TXT"
- "COMPILE_MAKE.TXT"
- "BUILDING.md"
- "CONTRIBUTING.md"
- "LICENSE.TXT"
- "LICENSE_LLVM.TXT"
- "README.md"
- "RELEASE_NOTES"
- "SPONSORS.TXT"
- "TODO"
pull_request:
release:
types: [published]
jobs:
build:
name: build_linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Create archive
id: archive
run: |
VERSION=${{ github.event.release.tag_name }}
PKGNAME="capstone-$VERSION"
SHASUM=$PKGNAME.tar.xz.sha256
mkdir -p /tmp/$PKGNAME
rsync -a --exclude=build --exclude='.*' ./ /tmp/$PKGNAME/
TARBALL=$PKGNAME.tar.xz
tar -C /tmp -cJf $TARBALL $PKGNAME
sha256sum $TARBALL > $SHASUM
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
echo "shasum=$SHASUM" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.archive.outputs.tarball }}
path: ${{ steps.archive.outputs.tarball }}
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.archive.outputs.shasum }}
path: ${{ steps.archive.outputs.shasum }}
- name: Upload tarball and shasum to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}
- name: Configure CMake and build the project
run: |
cmake -B build \
-DPROJECT_VERSION=${{ github.event.release.tag_name }} \
-DCMAKE_BUILD_TYPE=Release \
-DCAPSTONE_BUILD_SHARED_LIBS=1 \
-DCMAKE_INSTALL_PREFIX=/usr
cmake --build build
- name: Package DEB and RPM package
run: |
cd build
cpack -G DEB
cpack -G RPM
- uses: actions/upload-artifact@v4
with:
name: capstone_x86.deb
path: ./build/*.deb
- uses: actions/upload-artifact@v4
with:
name: capstone_x86.rpm
path: ./build/*.rpm
- name: Upload debian package to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
./build/*.deb
./build/*.rpm
build_windows:
name: build_windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Win MSVC 64 dev cmd setup
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure CMake and build the project
run: |
cmake -B build `
-T "ClangCL,host=x64" `
-A x64 `
-DPROJECT_VERSION="${{ github.event.release.tag_name }}" `
-DCMAKE_BUILD_TYPE=Release `
-DCAPSTONE_BUILD_SHARED_LIBS=1
cmake --build build --config Release
cmake --install build --config Release
# Install NSIS according to https://github.com/NSIS-Dev/ci-examples/blob/main/.github/workflows/windows-latest.yml
- name: Package NSIS installer
run: |
iwr -useb get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop update
scoop bucket add extras
scoop install nsis --global
cd build
cpack -G NSIS
- uses: actions/upload-artifact@v4
with:
name: capstone_x64.exe
path: ./build/*.exe
- name: Upload NSIS installer to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
./build/*.exe