Refactor GitHub Actions workflow to consolidate build jobs and add Mi… #18
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 and Release GhostInjector | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential mingw-w64 | |
| # Build for Linux | |
| - name: Configure CMake for Linux | |
| run: cmake -B build-linux -DCMAKE_BUILD_TYPE=Release | |
| - name: Build for Linux | |
| run: cmake --build build-linux | |
| - name: Rename Linux executable | |
| run: mv build-linux/ghostinjector-* build-linux/ghostinjector | |
| # Build for Windows | |
| - name: Configure CMake for Windows | |
| run: | | |
| cmake -B build-windows -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw.cmake -DCMAKE_BUILD_TYPE=Release | |
| - name: Build for Windows | |
| run: cmake --build build-windows | |
| - name: Rename Windows executable | |
| run: mv build-windows/ghostinjector-*.exe build-windows/ghostinjector.exe | |
| - name: Create Release | |
| if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ (github.ref == 'refs/heads/main' && 'latest') || github.ref_name }} | |
| name: ${{ (github.ref == 'refs/heads/main' && 'Latest Build (Development)') || github.ref_name }} | |
| body: | | |
| ## 🚀 Latest Development Build | |
| **Commit:** ${{ github.sha }} | |
| ### 📥 Download | |
| - **Windows:** `ghostinjector.exe` | |
| - **Linux:** `ghostinjector` | |
| files: | | |
| build-windows/ghostinjector.exe | |
| build-linux/ghostinjector | |
| draft: false | |
| prerelease: ${{ github.ref == 'refs/heads/main' }} | |
| make_latest: ${{ github.ref == 'refs/heads/main' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |