Refactor build workflow for releases and artifact handling #2
Workflow file for this run
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: Release Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on vx.x.x | |
| permissions: | |
| contents: write # Required to create a release and upload assets | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| binary_name: bbfmux | |
| compile_cmd: g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux -pthread | |
| - os: windows-latest | |
| binary_name: bbfmux.exe | |
| compile_cmd: g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux.exe -municode | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Compile | |
| run: ${{ matrix.compile_cmd }} | |
| - name: Upload temporary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os }}-bin | |
| path: ${{ matrix.binary_name }} | |
| create_release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: bin-temp | |
| merge-multiple: true | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| bin-temp/bbfmux | |
| bin-temp/bbfmux.exe | |
| generate_release_notes: true # Automatically summarizes commits since last release | |
| draft: false | |
| prerelease: false |