Always build packages and upload their artifacts. #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Source Release | |
| 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 | |
| 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: | |
| path: | | |
| ${{ steps.archive.outputs.tarball }} | |
| ${{ 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: | |
| path: build/*.deb | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| 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 | |
| # Install NSIS according to https://github.com/NSIS-Dev/ci-examples/blob/main/.github/workflows/windows-latest.yml | |
| - name: Install NSIS | |
| run: | | |
| iwr -useb get.scoop.sh -outfile 'install.ps1' | |
| .\install.ps1 -RunAsAdmin | |
| scoop update | |
| scoop bucket add extras | |
| scoop install nsis --global | |
| - 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 | |
| - name: Package NSIS installer | |
| run: | | |
| cd build | |
| cpack -G NSIS | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| 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 |