Build and Release DLLs #8
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-windows: | |
| name: Build (Windows) | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Build 64-bit | |
| run: | | |
| cmake -B build64 -A x64 | |
| cmake --build build64 --config Release | |
| - name: Build 32-bit | |
| run: | | |
| cmake -B build32 -A Win32 | |
| cmake --build build32 --config Release | |
| - name: Package outputs | |
| shell: bash | |
| run: | | |
| mkdir -p dist/windows/x64 dist/windows/x86 | |
| cp build64/Release/steam_api64.dll dist/windows/x64/ | |
| cp build32/Release/steam_api.dll dist/windows/x86/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uc-online2-windows-${{ github.ref_name }} | |
| path: dist/windows/ | |
| build-linux: | |
| name: Build (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build --config Release | |
| - name: Package outputs | |
| run: | | |
| mkdir -p dist/linux/x64 | |
| cp build/x64/libsteam_api64.so dist/linux/x64/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uc-online2-linux-${{ github.ref_name }} | |
| path: dist/linux/ | |
| build-macos: | |
| name: Build (macOS) | |
| runs-on: macos-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build --config Release | |
| - name: Package outputs | |
| run: | | |
| mkdir -p dist/macos/x64 | |
| cp build/x64/libsteam_api64.dylib dist/macos/x64/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uc-online2-macos-${{ github.ref_name }} | |
| path: dist/macos/ | |
| release: | |
| needs: [build-windows, build-linux, build-macos] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Package release archives | |
| run: | | |
| cd artifacts | |
| for platform_dir in */; do | |
| platform=$(basename "$platform_dir" | sed 's/uc-online2-//;s/-v.*//') | |
| archive="../uc-online2-${{ github.ref_name }}-${platform}.zip" | |
| zip -r "$archive" "$platform_dir" | |
| echo "Created: $archive" | |
| done | |
| - name: Publish release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| files: "*.zip" | |
| generate_release_notes: true | |
| fail_on_unmatched_files: false |