chore: bump version to {{version}} #13
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build-binary: | |
| name: Build Binary Artifact | |
| runs-on: ubuntu-latest | |
| env: | |
| SQLX_OFFLINE: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build release binary | |
| run: cargo build --release --bin replicant-server | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: replicant-server-${{ github.ref_name }} | |
| path: target/release/replicant-server | |
| retention-days: 90 | |
| docker-build-push: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| SQLX_OFFLINE=true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-dist: | |
| name: Build SDK (${{ matrix.platform }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux-x64 | |
| archive-ext: tar.gz | |
| - os: macos-latest | |
| platform: macos-universal | |
| archive-ext: tar.gz | |
| - os: windows-latest | |
| platform: windows-x64 | |
| archive-ext: zip | |
| env: | |
| SQLX_OFFLINE: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ runner.os == 'macOS' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build SDK (macOS - all variants) | |
| if: runner.os == 'macOS' | |
| run: | | |
| # Build for both architectures | |
| cargo build --package replicant-client --release --target aarch64-apple-darwin | |
| cargo build --package replicant-client --release --target x86_64-apple-darwin | |
| # Copy header from one of the builds (identical for both) | |
| mkdir -p replicant-client/target/include | |
| cp target/aarch64-apple-darwin/release/build/replicant-client-*/out/replicant.h \ | |
| replicant-client/target/include/ 2>/dev/null || \ | |
| find target/aarch64-apple-darwin -name "replicant.h" -path "*/out/*" -exec cp {} replicant-client/target/include/ \; | |
| # Create universal binaries | |
| mkdir -p target/release | |
| lipo -create -output target/release/libreplicant_client.a \ | |
| target/aarch64-apple-darwin/release/libreplicant_client.a \ | |
| target/x86_64-apple-darwin/release/libreplicant_client.a | |
| lipo -create -output target/release/libreplicant_client.dylib \ | |
| target/aarch64-apple-darwin/release/libreplicant_client.dylib \ | |
| target/x86_64-apple-darwin/release/libreplicant_client.dylib | |
| # Build dist with universal binaries | |
| python scripts/build_dist.py --skip-build | |
| cd dist && tar -czvf ../replicant-sdk-${{ github.ref_name }}-macos-universal.tar.gz . && cd .. | |
| # Swap in ARM64 libraries and create archive | |
| cp target/aarch64-apple-darwin/release/libreplicant_client.a dist/lib/ | |
| cp target/aarch64-apple-darwin/release/libreplicant_client.dylib dist/lib/ | |
| cd dist && tar -czvf ../replicant-sdk-${{ github.ref_name }}-macos-arm64.tar.gz . && cd .. | |
| # Swap in x86_64 libraries and create archive | |
| cp target/x86_64-apple-darwin/release/libreplicant_client.a dist/lib/ | |
| cp target/x86_64-apple-darwin/release/libreplicant_client.dylib dist/lib/ | |
| cd dist && tar -czvf ../replicant-sdk-${{ github.ref_name }}-macos-x86_64.tar.gz . && cd .. | |
| - name: Build SDK (Linux) | |
| if: runner.os == 'Linux' | |
| run: python scripts/build_dist.py | |
| - name: Build SDK (Windows - both CRT variants) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| # Build with static CRT | |
| $env:RUSTFLAGS = "-C target-feature=+crt-static" | |
| cargo build --package replicant-client --release | |
| # Copy header for build_dist.py | |
| New-Item -ItemType Directory -Force -Path replicant-client/target/include | |
| $headerPath = Get-ChildItem -Path target/release/build/replicant-client-*/out/replicant.h -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if ($headerPath) { | |
| Copy-Item $headerPath.FullName -Destination replicant-client/target/include/ | |
| } | |
| # Package static CRT variant | |
| python scripts/build_dist.py --skip-build | |
| Compress-Archive -Path dist/* -DestinationPath replicant-sdk-${{ github.ref_name }}-windows-x64-static-crt.zip | |
| # Clean for next build | |
| Remove-Item -Recurse -Force target/release | |
| Remove-Item -Recurse -Force dist/lib/* | |
| # Build with dynamic CRT (default) | |
| $env:RUSTFLAGS = "" | |
| cargo build --package replicant-client --release | |
| # Package dynamic CRT variant | |
| python scripts/build_dist.py --skip-build | |
| Compress-Archive -Path dist/* -DestinationPath replicant-sdk-${{ github.ref_name }}-windows-x64-dynamic-crt.zip | |
| - name: Create archive (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cd dist | |
| tar -czvf ../replicant-sdk-${{ github.ref_name }}-${{ matrix.platform }}.tar.gz . | |
| - name: Upload artifact (macOS) | |
| if: runner.os == 'macOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: replicant-sdk-macos | |
| path: | | |
| replicant-sdk-${{ github.ref_name }}-macos-universal.tar.gz | |
| replicant-sdk-${{ github.ref_name }}-macos-arm64.tar.gz | |
| replicant-sdk-${{ github.ref_name }}-macos-x86_64.tar.gz | |
| retention-days: 7 | |
| - name: Upload artifact (Linux) | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: replicant-sdk-${{ matrix.platform }} | |
| path: replicant-sdk-${{ github.ref_name }}-${{ matrix.platform }}.${{ matrix.archive-ext }} | |
| retention-days: 7 | |
| - name: Upload artifact (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: replicant-sdk-windows | |
| path: | | |
| replicant-sdk-${{ github.ref_name }}-windows-x64-static-crt.zip | |
| replicant-sdk-${{ github.ref_name }}-windows-x64-dynamic-crt.zip | |
| retention-days: 7 | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [build-binary, build-dist] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display artifacts | |
| run: ls -R artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| artifacts/replicant-server-${{ github.ref_name }}/replicant-server | |
| artifacts/replicant-sdk-linux-x64/* | |
| artifacts/replicant-sdk-macos/* | |
| artifacts/replicant-sdk-windows/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |