| 1 |
name: Build Source Release |
| 2 |
|
| 3 |
|
| 4 |
on: |
| 5 |
release: |
| 6 |
types: |
| 7 |
- created |
| 8 |
|
| 9 |
jobs: |
| 10 |
build: |
| 11 |
name: build |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- uses: actions/checkout@v4 |
| 15 |
with: |
| 16 |
submodules: true |
| 17 |
|
| 18 |
- name: Create archive |
| 19 |
id: archive |
| 20 |
run: | |
| 21 |
VERSION=${{ github.event.release.tag_name }} |
| 22 |
PKGNAME="capstone-$VERSION" |
| 23 |
SHASUM=$PKGNAME.tar.xz.sha256 |
| 24 |
mkdir -p /tmp/$PKGNAME |
| 25 |
mv * /tmp/$PKGNAME |
| 26 |
mv /tmp/$PKGNAME . |
| 27 |
TARBALL=$PKGNAME.tar.xz |
| 28 |
tar cJf $TARBALL $PKGNAME |
| 29 |
sha256sum $TARBALL > $SHASUM |
| 30 |
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT |
| 31 |
echo "shasum=$SHASUM" >> $GITHUB_OUTPUT |
| 32 |
|
| 33 |
- name: Upload tarball and shasum to release |
| 34 |
uses: softprops/action-gh-release@v2 |
| 35 |
env: |
| 36 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 |
with: |
| 38 |
tag_name: ${{ github.event.release.tag_name }} |
| 39 |
files: | |
| 40 |
${{ steps.archive.outputs.tarball }} |
| 41 |
${{ steps.archive.outputs.shasum }} |
| 42 |
|
| 43 |
- name: Configure CMake and build the packages |
| 44 |
run: | |
| 45 |
cmake -B build \ |
| 46 |
-DPROJECT_VERSION=${{ github.event.release.tag_name }} \ |
| 47 |
-DCMAKE_BUILD_TYPE=Release \ |
| 48 |
-DBUILD_SHARED_LIBS=1 \ |
| 49 |
-DCMAKE_INSTALL_PREFIX=/usr |
| 50 |
cmake --build build |
| 51 |
|
| 52 |
- name: Package DEB and RPM package |
| 53 |
run: | |
| 54 |
cd build |
| 55 |
cpack -G DEB |
| 56 |
cpack -G RPM |
| 57 |
|
| 58 |
- name: Upload debian package to release |
| 59 |
uses: softprops/action-gh-release@v2 |
| 60 |
env: |
| 61 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 |
with: |
| 63 |
tag_name: ${{ github.event.release.tag_name }} |
| 64 |
files: | |
| 65 |
./build/*.deb |
| 66 |
./build/*.rpm |