Release #78
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 | |
| with: | |
| submodules: recursive | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@1.95 | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "codeseek/rust-core" | |
| key: ${{ matrix.target }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Rust codeseek (${{ matrix.target }}) | |
| working-directory: codeseek/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: Prepare embedded binaries | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist/bin | |
| # Copy codeseek built from Rust | |
| cp codeseek/rust-core/target/${{ matrix.target }}/release/codeseek 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/codeseek dist/bin/fzf dist/bin/rg | |
| # Verify | |
| ls -la dist/bin/ | |
| echo "✓ Embedded binaries ready: codeseek, fzf, rg" | |
| - name: Build Go codeactor (${{ matrix.suffix }}) | |
| run: | | |
| go build \ | |
| -ldflags="-s -w -X 'codeactor/internal/globalctx.Version=${{ github.ref_name }}' -X 'codeactor/internal/globalctx.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)' -X 'codeactor/internal/globalctx.GitCommit=${{ github.sha }}'" \ | |
| -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 | |
| with: | |
| submodules: recursive | |
| - 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@1.95 | |
| with: | |
| targets: x86_64-unknown-linux-musl | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "codeseek/rust-core" | |
| key: musl-v2 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "25.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Apply vendored OpenSSL patch for musl build | |
| working-directory: codeseek | |
| run: git apply --verbose ../patches/codeseek-vendored-openssl.patch | |
| - name: Build Rust codeseek (static musl) | |
| working-directory: codeseek/rust-core | |
| run: | | |
| cargo build --release --target x86_64-unknown-linux-musl | |
| env: | |
| # Cross-compilation toolchain | |
| CC_x86_64_unknown_linux_musl: musl-gcc | |
| CXX_x86_64_unknown_linux_musl: musl-g++ | |
| AR_x86_64_unknown_linux_musl: ar | |
| CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc | |
| # OpenSSL configuration for vendored static build | |
| OPENSSL_STATIC: "1" | |
| # Allow cross-compilation pkg-config (safety net) | |
| PKG_CONFIG_ALLOW_CROSS: "1" | |
| - name: Prepare embedded binaries | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist/bin | |
| # Copy codeseek (musl static) | |
| cp codeseek/rust-core/target/x86_64-unknown-linux-musl/release/codeseek 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/codeseek dist/bin/fzf dist/bin/rg | |
| ls -la dist/bin/ | |
| echo "✓ Embedded binaries ready: codeseek, fzf, rg" | |
| - name: Build Go codeactor (linux-x64-musl) | |
| run: | | |
| go build \ | |
| -ldflags="-s -w -X 'codeactor/internal/globalctx.Version=${{ github.ref_name }}' -X 'codeactor/internal/globalctx.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)' -X 'codeactor/internal/globalctx.GitCommit=${{ github.sha }}'" \ | |
| -o codeactor \ | |
| . | |
| env: | |
| GOOS: linux | |
| GOARCH: amd64 | |
| CGO_ENABLED: "0" | |
| - name: Verify static linking | |
| run: | | |
| echo "=== Verifying static linking ===" | |
| file dist/bin/codeseek | |
| echo "" | |
| echo "=== Checking for dynamic symbols ===" | |
| if command -v readelf &> /dev/null; then | |
| readelf -d dist/bin/codeseek 2>&1 | head -20 || echo "(no dynamic section = fully static)" | |
| fi | |
| if command -v ldd &> /dev/null; then | |
| ldd dist/bin/codeseek 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" | |
| chmod +x codeactor | |
| tar -czf "${name}.tar.gz" codeactor | |
| cd ../.. | |
| echo "Created artifacts/${name}/${name}.tar.gz" | |
| done | |
| echo "" | |
| echo "=== Release assets ===" | |
| find artifacts -type f -name "*.tar.gz" -exec ls -lh {} \; | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/codeactor-darwin-x64/codeactor-darwin-x64.tar.gz | |
| artifacts/codeactor-darwin-arm64/codeactor-darwin-arm64.tar.gz | |
| artifacts/codeactor-linux-x64/codeactor-linux-x64.tar.gz | |
| artifacts/codeactor-linux-x64-musl/codeactor-linux-x64-musl.tar.gz | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true |