Enhance GitHub Actions workflow for building and releasing GhostInjector #17
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-windows-mingw: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up MinGW | |
| run: | | |
| choco install mingw | |
| echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $env:GITHUB_PATH | |
| - name: Configure CMake | |
| run: cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build | |
| - name: Rename executable | |
| run: move build\ghostinjector-*.exe build\ghostinjector.exe | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ghostinjector-windows | |
| path: build/ghostinjector.exe | |
| build-linux-gcc: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y build-essential | |
| - name: Configure CMake | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build | |
| - name: Rename executable | |
| run: mv build/ghostinjector-* build/ghostinjector | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ghostinjector-linux | |
| path: build/ghostinjector | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-windows-mingw, build-linux-gcc] | |
| if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| 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: | | |
| artifacts/ghostinjector-windows/ghostinjector.exe | |
| artifacts/ghostinjector-linux/ghostinjector | |
| draft: false | |
| prerelease: ${{ github.ref == 'refs/heads/main' }} | |
| make_latest: ${{ github.ref == 'refs/heads/main' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |