Enhance logging functionality: add dynamic log file naming and improv… #25
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 mingw-w64 | |
| - name: Configure CMake (Release) | |
| run: | | |
| cmake -B build -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw.cmake -DCMAKE_BUILD_TYPE=Release | |
| - name: Build (Release) | |
| run: cmake --build build | |
| - name: Strip executable (Release) | |
| run: x86_64-w64-mingw32-strip build/ghostinjector-*.exe | |
| - name: Rename executable (Release) | |
| run: mv build/ghostinjector-*.exe build/ghostinjector.exe | |
| - name: Configure CMake (Debug - LOG_LEVEL_3) | |
| run: | | |
| cmake -B build-debug -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw.cmake -DCMAKE_BUILD_TYPE=Debug -DDEBUG_BUILD=ON -DCMAKE_EXE_LINKER_FLAGS="" -DCMAKE_SHARED_LINKER_FLAGS="" | |
| - name: Build (Debug) | |
| run: cmake --build build-debug | |
| - name: Rename executable (Debug) | |
| run: mv build-debug/ghostinjector-*.exe build-debug/ghostinjector-debug.exe | |
| - name: Ensure full git history | |
| run: | | |
| # Fetch full history so changelog generation works reliably | |
| git fetch --prune --unshallow || true | |
| - name: Generate release notes | |
| id: changelog | |
| run: | | |
| set -e | |
| if [[ "${{ github.ref }}" == refs/heads/main ]]; then | |
| echo "Latest development build for commit ${{ github.sha }}" > release_notes.txt | |
| echo "" >> release_notes.txt | |
| echo "Changes since last release (shortlog):" >> release_notes.txt | |
| git --no-pager shortlog --pretty=format:"%h %s" -n main | head -200 >> release_notes.txt || true | |
| else | |
| TAG=${GITHUB_REF_NAME:-${GITHUB_REF#refs/tags/}} | |
| echo "Release $TAG" > release_notes.txt | |
| echo "" >> release_notes.txt | |
| echo "Changelog (shortlog):" >> release_notes.txt | |
| git --no-pager shortlog --pretty=format:"%h %s" -n $TAG | head -200 >> release_notes.txt || true | |
| fi | |
| echo "notes_path=release_notes.txt" >> $GITHUB_OUTPUT | |
| - name: Upload release notes artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-notes | |
| path: release_notes.txt | |
| - name: Create/Update 'latest' release (development) | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| name: Latest Build (Development) | |
| body_path: release_notes.txt | |
| files: | | |
| build/ghostinjector.exe | |
| build-debug/ghostinjector-debug.exe | |
| draft: false | |
| prerelease: true | |
| make_latest: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create stable release for tags | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| body_path: release_notes.txt | |
| files: | | |
| build/ghostinjector.exe | |
| build-debug/ghostinjector-debug.exe | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |