name: Release on: push: tags: - "v*" permissions: contents: write jobs: build: name: Build ${{ matrix.asset }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu asset: linux-x64 - os: ubuntu-latest target: aarch64-unknown-linux-gnu asset: linux-arm64 - os: macos-14 target: aarch64-apple-darwin asset: darwin-arm64 steps: - name: Check out source uses: actions/checkout@v4 - name: Install Rust toolchain and target uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install Linux ARM64 linker if: matrix.target == 'aarch64-unknown-linux-gnu' run: sudo apt-get update && sudo apt-get install --yes gcc-aarch64-linux-gnu - name: Build release binary shell: bash run: | if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc fi cargo build --release --locked --target "${{ matrix.target }}" cp "target/${{ matrix.target }}/release/idx" "idx-${{ matrix.asset }}" chmod 0755 "idx-${{ matrix.asset }}" - name: Upload target artifact uses: actions/upload-artifact@v4 with: name: idx-${{ matrix.asset }} path: idx-${{ matrix.asset }} if-no-files-found: error publish: name: Attach binaries to release needs: build runs-on: ubuntu-latest steps: - name: Download target artifacts uses: actions/download-artifact@v4 with: pattern: idx-* merge-multiple: true - name: Attach binaries to the version tag uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} files: | idx-linux-x64 idx-linux-arm64 idx-darwin-arm64