Release #18
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 | |
| goos: darwin | |
| goarch: amd64 | |
| fzf_url: https://github.com/junegunn/fzf/releases/download/v0.73.1/fzf-0.73.1-darwin_amd64.tar.gz | |
| rg_url: https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-apple-darwin.tar.gz | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| suffix: darwin-arm64 | |
| goos: darwin | |
| goarch: arm64 | |
| fzf_url: https://github.com/junegunn/fzf/releases/download/v0.73.1/fzf-0.73.1-darwin_arm64.tar.gz | |
| rg_url: https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-aarch64-apple-darwin.tar.gz | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| suffix: linux-x64 | |
| goos: linux | |
| goarch: amd64 | |
| fzf_url: https://github.com/junegunn/fzf/releases/download/v0.73.1/fzf-0.73.1-linux_amd64.tar.gz | |
| rg_url: https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz | |
| 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: "codexray" | |
| key: ${{ matrix.target }} | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - name: Build Rust codexray (${{ matrix.target }}) | |
| working-directory: codexray | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| CC_x86_64_apple_darwin: clang -arch x86_64 | |
| MACOSX_DEPLOYMENT_TARGET: "10.15" | |
| - name: Prepare embedded binaries | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist/bin | |
| # Copy codeactor-codexray built from Rust | |
| cp codexray/target/${{ matrix.target }}/release/codeactor-codexray dist/bin/ | |
| # Download and extract fzf | |
| echo "Downloading fzf from ${{ matrix.fzf_url }}" | |
| curl -fLo /tmp/fzf.tar.gz "${{ matrix.fzf_url }}" | |
| tar -xzf /tmp/fzf.tar.gz -C /tmp | |
| mv /tmp/fzf dist/bin/fzf | |
| rm -f /tmp/fzf.tar.gz | |
| # Download and extract rg (rg 在 tar 中有目录前缀,用 find 定位) | |
| echo "Downloading rg from ${{ matrix.rg_url }}" | |
| curl -fLo /tmp/rg.tar.gz "${{ matrix.rg_url }}" | |
| mkdir -p /tmp/rg_extract | |
| tar -xzf /tmp/rg.tar.gz -C /tmp/rg_extract | |
| find /tmp/rg_extract -name rg -type f -exec mv {} dist/bin/rg \; | |
| rm -rf /tmp/rg_extract /tmp/rg.tar.gz | |
| # Set executable permissions | |
| chmod +x dist/bin/codeactor-codexray dist/bin/fzf dist/bin/rg | |
| # Verify | |
| ls -la dist/bin/ | |
| - name: Build Go codeactor (${{ matrix.suffix }}) | |
| run: | | |
| go build \ | |
| -ldflags="-s -w" \ | |
| -o codeactor \ | |
| . | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "0" | |
| - name: Verify artifact | |
| run: | | |
| file codeactor | |
| echo "---" | |
| ls -lh codeactor | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codeactor-${{ matrix.suffix }} | |
| path: codeactor | |
| if-no-files-found: error | |
| centos7-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: "codexray" | |
| key: musl | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - name: Build Rust codexray (static musl) | |
| working-directory: codexray | |
| 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: Prepare embedded binaries | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist/bin | |
| # Copy codeactor-codexray (musl static) | |
| cp codexray/target/x86_64-unknown-linux-musl/release/codeactor-codexray dist/bin/ | |
| # Download fzf | |
| echo "Downloading fzf..." | |
| curl -fLo /tmp/fzf.tar.gz "https://github.com/junegunn/fzf/releases/download/v0.73.1/fzf-0.73.1-linux_amd64.tar.gz" | |
| tar -xzf /tmp/fzf.tar.gz -C /tmp | |
| mv /tmp/fzf dist/bin/fzf | |
| rm -f /tmp/fzf.tar.gz | |
| # Download ripgrep (musl build for static linking) | |
| echo "Downloading ripgrep..." | |
| curl -fLo /tmp/rg.tar.gz "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz" | |
| mkdir -p /tmp/rg_extract | |
| tar -xzf /tmp/rg.tar.gz -C /tmp/rg_extract | |
| find /tmp/rg_extract -name rg -type f -exec mv {} dist/bin/rg \; | |
| rm -rf /tmp/rg_extract /tmp/rg.tar.gz | |
| chmod +x dist/bin/codeactor-codexray dist/bin/fzf dist/bin/rg | |
| ls -la dist/bin/ | |
| - name: Build Go codeactor (linux-x64-musl) | |
| run: | | |
| go build \ | |
| -ldflags="-s -w" \ | |
| -o codeactor \ | |
| . | |
| env: | |
| GOOS: linux | |
| GOARCH: amd64 | |
| CGO_ENABLED: "0" | |
| - name: Verify static linking | |
| run: | | |
| echo "=== Verifying static linking ===" | |
| file dist/bin/codeactor-codexray | |
| echo "" | |
| echo "=== Checking for dynamic symbols ===" | |
| if command -v readelf &> /dev/null; then | |
| readelf -d dist/bin/codeactor-codexray 2>&1 | head -20 || echo "(no dynamic section = fully static)" | |
| fi | |
| if command -v ldd &> /dev/null; then | |
| ldd dist/bin/codeactor-codexray 2>&1 | head -10 || true | |
| fi | |
| - name: Verify artifact | |
| run: | | |
| file codeactor | |
| echo "---" | |
| ls -lh codeactor | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codeactor-linux-x64-musl | |
| path: codeactor | |
| if-no-files-found: error | |
| create-release: | |
| name: Create Release | |
| needs: [build, centos7-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: Package release assets | |
| run: | | |
| set -euo pipefail | |
| echo "=== Artifacts structure ===" | |
| find artifacts -type f -exec ls -lh {} \; | |
| echo "" | |
| echo "=== Packaging release assets ===" | |
| for dir in artifacts/*/; do | |
| name="$(basename "$dir")" | |
| cd "artifacts/$name" | |
| zip "${name}.zip" codeactor | |
| cd ../.. | |
| echo "Created artifacts/${name}/${name}.zip" | |
| done | |
| echo "" | |
| echo "=== Release assets ===" | |
| find artifacts -type f -name "*.zip" -exec ls -lh {} \; | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/codeactor-darwin-x64/codeactor-darwin-x64.zip | |
| artifacts/codeactor-darwin-arm64/codeactor-darwin-arm64.zip | |
| artifacts/codeactor-linux-x64/codeactor-linux-x64.zip | |
| artifacts/codeactor-linux-x64-musl/codeactor-linux-x64-musl.zip | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true |