Merge pull request #11 from swiftly-solution/dev #42
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 Static Libraries | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-linux: | |
| name: Build Linux (SteamOS SDK) | |
| runs-on: ubuntu-latest | |
| container: | |
| image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Rust version | |
| run: | | |
| . $HOME/.cargo/env | |
| rustc --version | |
| cargo --version | |
| - name: Build release | |
| run: | | |
| . $HOME/.cargo/env | |
| cargo build --release | |
| - name: Upload Linux artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: s2binlib-linux-x86_64 | |
| path: target/release/libs2binlib.a | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: s2binlib-windows-x86_64 | |
| path: | | |
| target/release/s2binlib.lib | |
| create-release-package: | |
| name: Create Release Package | |
| needs: [build-linux, build-windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v1.1.1 | |
| with: | |
| versionSpec: '5.x' | |
| - name: Determine Version | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v1.1.1 | |
| with: | |
| useConfigFile: true | |
| configFilePath: gitversion.yml | |
| - name: Display GitVersion outputs | |
| run: | | |
| echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" | |
| echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" | |
| echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create release directory | |
| run: | | |
| mkdir -p release/linux | |
| mkdir -p release/windows | |
| mkdir -p release/include | |
| cp artifacts/s2binlib-linux-x86_64/libs2binlib.a release/linux/ | |
| cp artifacts/s2binlib-windows-x86_64/s2binlib.lib release/windows/ | |
| cp s2binlib.h release/include/ | |
| - name: Create release archives | |
| run: | | |
| cd release | |
| tar -czf ../s2binlib-${{ steps.gitversion.outputs.semVer }}-linux-x86_64.tar.gz linux/ include/ | |
| tar -czf ../s2binlib-${{ steps.gitversion.outputs.semVer }}-windows-x86_64.tar.gz windows/ include/ | |
| cd .. | |
| tar -czf s2binlib-${{ steps.gitversion.outputs.semVer }}-all-platforms.tar.gz release/ | |
| - name: Upload combined release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: s2binlib-all-platforms | |
| path: release/ | |
| - name: Create GitHub Release | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.gitversion.outputs.semVer }} | |
| name: Release v${{ steps.gitversion.outputs.semVer }} | |
| body: | | |
| ## s2binlib v${{ steps.gitversion.outputs.semVer }} | |
| ### 📦 Downloads | |
| - `s2binlib-${{ steps.gitversion.outputs.semVer }}-linux-x86_64.tar.gz` - Linux static library | |
| - `s2binlib-${{ steps.gitversion.outputs.semVer }}-windows-x86_64.tar.gz` - Windows static library | |
| - `s2binlib-${{ steps.gitversion.outputs.semVer }}-all-platforms.tar.gz` - All platforms bundle | |
| ### 📋 Changes | |
| Auto-generated release from commit ${{ github.sha }} | |
| ### 🔧 Build Information | |
| - Version: ${{ steps.gitversion.outputs.fullSemVer }} | |
| - Commit: ${{ github.sha }} | |
| - Branch: ${{ github.ref_name }} | |
| files: | | |
| s2binlib-${{ steps.gitversion.outputs.semVer }}-linux-x86_64.tar.gz | |
| s2binlib-${{ steps.gitversion.outputs.semVer }}-windows-x86_64.tar.gz | |
| s2binlib-${{ steps.gitversion.outputs.semVer }}-all-platforms.tar.gz | |
| s2binlib.h | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |