Build Release Artifacts #12
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 Release Artifacts | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| env: | |
| CONFIG: Release | |
| jobs: | |
| linux-omp: | |
| name: Build Linux .so - open.mp (32-bit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (with submodules) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Prepare build folder | |
| run: | | |
| mkdir -p docker/build-omp | |
| sudo chown 1000:1000 docker/build-omp | |
| - name: Build Docker image | |
| run: | | |
| docker build -t randomix/build:ubuntu-22.04 docker/build_ubuntu-22.04/ | |
| - name: Build open.mp component | |
| run: | | |
| docker run --rm -t \ | |
| -w /code \ | |
| -v "${{ github.workspace }}:/code" \ | |
| -v "${{ github.workspace }}/docker/build-omp:/code/build" \ | |
| -e CONFIG=${{ env.CONFIG }} \ | |
| -e BUILD_SAMP_PLUGIN=0 \ | |
| randomix/build:ubuntu-22.04 | |
| - name: Upload open.mp artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: randomix-omp-linux | |
| path: docker/build-omp/Randomix.so | |
| linux-samp: | |
| name: Build Linux .so - SA-MP (32-bit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (with submodules) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Prepare build folder | |
| run: | | |
| mkdir -p docker/build-samp | |
| sudo chown 1000:1000 docker/build-samp | |
| - name: Build Docker image | |
| run: | | |
| docker build -t randomix/build:ubuntu-22.04 docker/build_ubuntu-22.04/ | |
| - name: Build SA-MP plugin | |
| run: | | |
| docker run --rm -t \ | |
| -w /code \ | |
| -v "${{ github.workspace }}:/code" \ | |
| -v "${{ github.workspace }}/docker/build-samp:/code/build" \ | |
| -e CONFIG=${{ env.CONFIG }} \ | |
| -e BUILD_SAMP_PLUGIN=1 \ | |
| randomix/build:ubuntu-22.04 | |
| - name: Upload SA-MP artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: randomix-samp-linux | |
| path: docker/build-samp/Randomix.so | |
| windows-omp: | |
| name: Build Windows .dll - open.mp (32-bit) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Configure CMake for open.mp | |
| run: | | |
| cmake -S . -B build-omp -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 | |
| shell: powershell | |
| - name: Build open.mp | |
| run: | | |
| cmake --build build-omp --config Release --parallel | |
| shell: powershell | |
| - name: Upload open.mp artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: randomix-omp-windows | |
| path: build-omp/Release/Randomix.dll | |
| windows-samp: | |
| name: Build Windows .dll - SA-MP (32-bit) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Configure CMake for SA-MP | |
| run: | | |
| cmake -S . -B build-samp -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_SAMP_PLUGIN=ON | |
| shell: powershell | |
| - name: Build SA-MP | |
| run: | | |
| cmake --build build-samp --config Release --parallel | |
| shell: powershell | |
| - name: Upload SA-MP artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: randomix-samp-windows | |
| path: build-samp/Release/Randomix.dll | |
| release: | |
| name: Create Release | |
| needs: [linux-omp, linux-samp, windows-omp, windows-samp] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display artifacts | |
| run: | | |
| echo "=== Artifacts ===" | |
| find artifacts -type f -name "*.so" -o -name "*.dll" | sort | |
| - name: Rename artifacts | |
| run: | | |
| mkdir -p release | |
| cp artifacts/randomix-omp-linux/Randomix.so release/Randomix-omp-linux-x86.so | |
| cp artifacts/randomix-samp-linux/Randomix.so release/Randomix-samp-linux-x86.so | |
| cp artifacts/randomix-omp-windows/Randomix.dll release/Randomix-omp-win-x86.dll | |
| cp artifacts/randomix-samp-windows/Randomix.dll release/Randomix-samp-win-x86.dll | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |