This repository was archived by the owner on Aug 7, 2026. It is now read-only.
Repository navigation
fix: add postinstall to make binary executable #7
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: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| if: github.event.pull_request.merged == true && (contains(github.event.pull_request.labels.*.name, 'release:major') || contains(github.event.pull_request.labels.*.name, 'release:minor') || contains(github.event.pull_request.labels.*.name, 'release:patch')) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.new.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine version bump | |
| id: bump | |
| run: | | |
| if ${{ contains(github.event.pull_request.labels.*.name, 'release:major') }}; then | |
| echo "type=major" >> $GITHUB_OUTPUT | |
| elif ${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }}; then | |
| echo "type=minor" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=patch" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get current version | |
| id: current | |
| run: | | |
| VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Calculate new version | |
| id: new | |
| run: | | |
| IFS='.' read -r major minor patch <<< "${{ steps.current.outputs.version }}" | |
| case "${{ steps.bump.outputs.type }}" in | |
| major) echo "version=$((major + 1)).0.0" >> $GITHUB_OUTPUT ;; | |
| minor) echo "version=${major}.$((minor + 1)).0" >> $GITHUB_OUTPUT ;; | |
| patch) echo "version=${major}.${minor}.$((patch + 1))" >> $GITHUB_OUTPUT ;; | |
| esac | |
| - name: Update version in Cargo.toml | |
| run: | | |
| sed -i 's/^version = ".*"/version = "${{ steps.new.outputs.version }}"/' Cargo.toml | |
| - name: Commit and tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Cargo.toml | |
| git commit -m "chore: release v${{ steps.new.outputs.version }}" | |
| git tag -a "v${{ steps.new.outputs.version }}" -m "Release v${{ steps.new.outputs.version }}" | |
| git push origin main | |
| git push origin "v${{ steps.new.outputs.version }}" | |
| build: | |
| needs: release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| asset_name: lambda-cli-x86_64-unknown-linux-gnu | |
| npm_os: linux | |
| npm_arch: x64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| asset_name: lambda-cli-x86_64-apple-darwin | |
| npm_os: darwin | |
| npm_arch: x64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| asset_name: lambda-cli-aarch64-apple-darwin | |
| npm_os: darwin | |
| npm_arch: arm64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| asset_name: lambda-cli-x86_64-pc-windows-msvc | |
| npm_os: win32 | |
| npm_arch: x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: v${{ needs.release.outputs.version }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build release | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Create tarball (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar -czvf ../../../${{ matrix.asset_name }}.tar.gz lambda lambda-mcp | |
| - name: Create tarball (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| 7z a ../../../${{ matrix.asset_name }}.zip lambda.exe lambda-mcp.exe | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }} | |
| - name: Create npm platform package | |
| run: | | |
| mkdir -p npm-pkg/bin | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| cp target/${{ matrix.target }}/release/lambda-mcp.exe npm-pkg/bin/ | |
| else | |
| cp target/${{ matrix.target }}/release/lambda-mcp npm-pkg/bin/ | |
| chmod +x npm-pkg/bin/lambda-mcp | |
| fi | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| cat > npm-pkg/package.json << EOF | |
| { | |
| "name": "@strand-ai/lambda-mcp-${{ matrix.npm_os }}-${{ matrix.npm_arch }}", | |
| "version": "${{ needs.release.outputs.version }}", | |
| "description": "Platform-specific binary for lambda-mcp (${{ matrix.npm_os }}-${{ matrix.npm_arch }})", | |
| "os": ["${{ matrix.npm_os }}"], | |
| "cpu": ["${{ matrix.npm_arch }}"], | |
| "repository": { "type": "git", "url": "https://github.com/Strand-AI/lambda-cli" }, | |
| "license": "MIT" | |
| } | |
| EOF | |
| else | |
| cat > npm-pkg/package.json << EOF | |
| { | |
| "name": "@strand-ai/lambda-mcp-${{ matrix.npm_os }}-${{ matrix.npm_arch }}", | |
| "version": "${{ needs.release.outputs.version }}", | |
| "description": "Platform-specific binary for lambda-mcp (${{ matrix.npm_os }}-${{ matrix.npm_arch }})", | |
| "os": ["${{ matrix.npm_os }}"], | |
| "cpu": ["${{ matrix.npm_arch }}"], | |
| "repository": { "type": "git", "url": "https://github.com/Strand-AI/lambda-cli" }, | |
| "license": "MIT", | |
| "scripts": { "postinstall": "chmod +x bin/lambda-mcp 2>/dev/null || true" } | |
| } | |
| EOF | |
| fi | |
| shell: bash | |
| - name: Upload npm package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-lambda-mcp-${{ matrix.npm_os }}-${{ matrix.npm_arch }} | |
| path: npm-pkg/ | |
| publish: | |
| needs: [release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.release.outputs.version }} | |
| files: | | |
| artifacts/**/*.tar.gz | |
| artifacts/**/*.zip | |
| generate_release_notes: true | |
| update-homebrew: | |
| needs: [release, publish] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Compute SHA256 | |
| id: sha256 | |
| run: | | |
| TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${{ needs.release.outputs.version }}.tar.gz" | |
| SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | cut -d' ' -f1) | |
| echo "sha256=$SHA256" >> $GITHUB_OUTPUT | |
| - name: Checkout homebrew-tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Strand-AI/homebrew-tap | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-tap | |
| - name: Update formula | |
| run: | | |
| cat > homebrew-tap/Formula/lambda-cli.rb << 'EOF' | |
| class LambdaCli < Formula | |
| desc "CLI and MCP server for Lambda Labs cloud GPU instances" | |
| homepage "https://github.com/Strand-AI/lambda-cli" | |
| url "https://github.com/Strand-AI/lambda-cli/archive/refs/tags/v${{ needs.release.outputs.version }}.tar.gz" | |
| sha256 "${{ steps.sha256.outputs.sha256 }}" | |
| license "MIT" | |
| head "https://github.com/Strand-AI/lambda-cli.git", branch: "main" | |
| depends_on "rust" => :build | |
| def install | |
| system "cargo", "build", "--release" | |
| bin.install "target/release/lambda" | |
| bin.install "target/release/lambda-mcp" | |
| end | |
| test do | |
| assert_match "lambda", shell_output("#{bin}/lambda --version") | |
| end | |
| end | |
| EOF | |
| - name: Commit and push | |
| run: | | |
| cd homebrew-tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/lambda-cli.rb | |
| git commit -m "lambda-cli: update to ${{ needs.release.outputs.version }}" | |
| git push | |
| publish-npm: | |
| needs: [release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: v${{ needs.release.outputs.version }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Download npm package artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: npm-lambda-mcp-* | |
| path: npm-packages | |
| - name: Publish platform packages | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| for pkg_dir in npm-packages/npm-lambda-mcp-*/; do | |
| echo "Publishing $pkg_dir" | |
| cd "$pkg_dir" | |
| npm publish --access public | |
| cd - | |
| done | |
| - name: Prepare and publish main package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| cd npm/lambda-mcp | |
| # Update version in package.json | |
| sed -i 's/"version": "0.0.0"/"version": "${{ needs.release.outputs.version }}"/' package.json | |
| # Update optional dependency versions | |
| sed -i 's/"@strand-ai\/lambda-mcp-linux-x64": "0.0.0"/"@strand-ai\/lambda-mcp-linux-x64": "${{ needs.release.outputs.version }}"/' package.json | |
| sed -i 's/"@strand-ai\/lambda-mcp-darwin-x64": "0.0.0"/"@strand-ai\/lambda-mcp-darwin-x64": "${{ needs.release.outputs.version }}"/' package.json | |
| sed -i 's/"@strand-ai\/lambda-mcp-darwin-arm64": "0.0.0"/"@strand-ai\/lambda-mcp-darwin-arm64": "${{ needs.release.outputs.version }}"/' package.json | |
| sed -i 's/"@strand-ai\/lambda-mcp-win32-x64": "0.0.0"/"@strand-ai\/lambda-mcp-win32-x64": "${{ needs.release.outputs.version }}"/' package.json | |
| npm install | |
| npm run build | |
| npm publish --access public |