Add Snowflake docs (#138) #208
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: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.continue-on-error || false }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| binary_name: surreal-sync | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| binary_name: surreal-sync | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| binary_name: surreal-sync | |
| continue-on-error: true | |
| # - target: aarch64-unknown-linux-musl | |
| # os: ubuntu-latest | |
| # binary_name: surreal-sync | |
| # macOS | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| binary_name: surreal-sync | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup toolchain install | |
| rustup target add ${{ matrix.target }} | |
| - name: Install system build dependencies | |
| if: contains(matrix.target, 'linux') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential cmake libssl-dev libsasl2-dev pkg-config protobuf-compiler | |
| - name: Install cross-compilation tools | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| case "${{ matrix.target }}" in | |
| x86_64-unknown-linux-musl) | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| ;; | |
| aarch64-unknown-linux-musl) | |
| sudo dpkg --add-architecture arm64 | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools:arm64 | |
| ;; | |
| esac | |
| - name: Build binary | |
| run: | | |
| FEATURES="" | |
| case "${{ matrix.target }}" in | |
| *-musl) | |
| FEATURES="--features vendored-openssl" | |
| export CC=musl-gcc | |
| ;; | |
| esac | |
| cargo build --release --target ${{ matrix.target }} $FEATURES | |
| - name: Create archive | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| # Windows | |
| cp "target/${{ matrix.target }}/release/${{ matrix.binary_name }}" dist/ | |
| cd dist | |
| 7z a "../surreal-sync-${{ matrix.target }}.zip" "${{ matrix.binary_name }}" | |
| cd .. | |
| else | |
| # Unix | |
| cp "target/${{ matrix.target }}/release/${{ matrix.binary_name }}" dist/ | |
| cd dist | |
| tar czf "../surreal-sync-${{ matrix.target }}.tar.gz" "${{ matrix.binary_name }}" | |
| cd .. | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: surreal-sync-${{ matrix.target }} | |
| path: | | |
| surreal-sync-${{ matrix.target }}.tar.gz | |
| surreal-sync-${{ matrix.target }}.zip | |
| if-no-files-found: error | |
| retention-days: 7 | |
| publish: | |
| name: Publish Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/') }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: surreal-sync-* | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| # Generate checksums only for files that exist | |
| for file in surreal-sync-*.tar.gz surreal-sync-*.zip; do | |
| if [ -e "$file" ]; then | |
| sha256sum "$file" >> checksums.txt | |
| fi | |
| done | |
| # Ensure at least one archive exists | |
| if [ ! -s checksums.txt ]; then | |
| echo "Error: No archives found to generate checksums" | |
| exit 1 | |
| fi | |
| echo "Generated checksums for:" | |
| cat checksums.txt | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| # Collect all available archives | |
| ARCHIVES="" | |
| for file in surreal-sync-*.tar.gz surreal-sync-*.zip checksums.txt; do | |
| if [ -e "$file" ]; then | |
| ARCHIVES="$ARCHIVES $file" | |
| fi | |
| done | |
| echo "Publishing release $TAG with artifacts:" | |
| echo "$ARCHIVES" | |
| gh release create "$TAG" \ | |
| --title "Release $TAG" \ | |
| --notes "Release $TAG" \ | |
| $ARCHIVES |