Replace println-based setup wizard with dialoguer TUI prompts #4
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*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version' | |
| required: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| suffix: darwin-x64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| suffix: darwin-arm64 | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| suffix: linux-x64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rust-core" | |
| key: ${{ matrix.target }} | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Rust binary (${{ matrix.target }}) | |
| working-directory: rust-core | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| CC_x86_64_apple_darwin: clang -arch x86_64 | |
| MACOSX_DEPLOYMENT_TARGET: "10.15" | |
| - name: Create release archive (tar.gz) | |
| run: | | |
| BIN_DIR="codexray-${{ matrix.suffix }}" | |
| mkdir -p "$BIN_DIR" | |
| # Copy binary | |
| cp rust-core/target/${{ matrix.target }}/release/codexray "$BIN_DIR/" | |
| # Copy docs | |
| cp rust-core/LICENSE "$BIN_DIR/" 2>/dev/null || true | |
| cp rust-core/README.md "$BIN_DIR/" 2>/dev/null || true | |
| cp rust-core/README_ZH.md "$BIN_DIR/" 2>/dev/null || true | |
| # Ensure execute permission is set | |
| chmod +x "$BIN_DIR/codexray" | |
| # Create tar.gz (preserves execute permissions) | |
| tar -czf "codexray-${{ matrix.suffix }}.tar.gz" "$BIN_DIR" | |
| # Verify | |
| echo "Archive contents:" | |
| tar -tzf "codexray-${{ matrix.suffix }}.tar.gz" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codexray-${{ matrix.suffix }} | |
| path: codexray-${{ matrix.suffix }}.tar.gz | |
| if-no-files-found: error | |
| musl-build: | |
| name: Build linux-x64 (musl static) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install musl tools and build deps | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools perl make pkg-config | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-unknown-linux-musl | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rust-core" | |
| key: musl | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Rust binary (static musl) | |
| working-directory: rust-core | |
| run: | | |
| export CC_x86_64_unknown_linux_musl=musl-gcc | |
| export CXX_x86_64_unknown_linux_musl=musl-g++ | |
| cargo build --release --target x86_64-unknown-linux-musl | |
| - name: Verify static linking | |
| run: | | |
| echo "=== Verifying static linking ===" | |
| file rust-core/target/x86_64-unknown-linux-musl/release/codexray | |
| echo "" | |
| echo "=== Checking for dynamic symbols ===" | |
| if command -v readelf &> /dev/null; then | |
| readelf -d rust-core/target/x86_64-unknown-linux-musl/release/codexray 2>&1 | head -20 || echo "(no dynamic section = fully static)" | |
| fi | |
| if command -v ldd &> /dev/null; then | |
| ldd rust-core/target/x86_64-unknown-linux-musl/release/codexray 2>&1 | head -10 || true | |
| fi | |
| - name: Create release archive (tar.gz) | |
| run: | | |
| BIN_DIR="codexray-linux-x64-musl" | |
| mkdir -p "$BIN_DIR" | |
| cp rust-core/target/x86_64-unknown-linux-musl/release/codexray "$BIN_DIR/" | |
| cp rust-core/LICENSE "$BIN_DIR/" 2>/dev/null || true | |
| cp rust-core/README.md "$BIN_DIR/" 2>/dev/null || true | |
| cp rust-core/README_ZH.md "$BIN_DIR/" 2>/dev/null || true | |
| chmod +x "$BIN_DIR/codexray" | |
| tar -czf "codexray-linux-x64-musl.tar.gz" "$BIN_DIR" | |
| echo "Archive contents:" | |
| tar -tzf "codexray-linux-x64-musl.tar.gz" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codexray-linux-x64-musl | |
| path: codexray-linux-x64-musl.tar.gz | |
| if-no-files-found: error | |
| create-release: | |
| name: Create Release | |
| needs: [build, musl-build] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Organize release assets | |
| run: | | |
| set -euo pipefail | |
| echo "=== Artifacts structure ===" | |
| find artifacts -type f -exec ls -lh {} \; | |
| echo "" | |
| mkdir -p release | |
| for dir in artifacts/*/; do | |
| name="$(basename "$dir")" | |
| cp "$dir/${name}.tar.gz" "release/" 2>/dev/null || true | |
| done | |
| echo "=== Release assets ===" | |
| ls -lh release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| release/codexray-darwin-x64.tar.gz | |
| release/codexray-darwin-arm64.tar.gz | |
| release/codexray-linux-x64.tar.gz | |
| release/codexray-linux-x64-musl.tar.gz | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-npm: | |
| name: Publish to npm | |
| needs: [build, musl-build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies & build | |
| run: | | |
| npm install | |
| npm run build | |
| - name: Publish | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |