|
| 1 | +# Manual fork binary build for any selected branch. |
| 2 | +# Simple path: build one Linux x64 binary and upload it as a workflow artifact. |
| 3 | +# It does not publish GitHub Releases and does not use the release workflow. |
| 4 | +name: Fork Binary Release |
| 5 | + |
| 6 | +run-name: fork binary release @ ${{ github.ref_name }} |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: "Optional version string embedded in the binary, e.g. fork-preview" |
| 13 | + required: false |
| 14 | + type: string |
| 15 | + default: "" |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-linux-amd64: |
| 22 | + name: Build Linux amd64 artifact |
| 23 | + runs-on: ubuntu-latest |
| 24 | + timeout-minutes: 120 |
| 25 | + steps: |
| 26 | + - name: Annotate selected branch |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + echo "::notice title=Selected ref::Building fork binary artifact from ${GITHUB_REF_NAME}." |
| 30 | +
|
| 31 | + - name: Checkout selected ref |
| 32 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 33 | + |
| 34 | + - name: Install build dependencies |
| 35 | + run: sudo apt-get update && sudo apt-get install -y build-essential zlib1g-dev |
| 36 | + |
| 37 | + - name: Build binary |
| 38 | + shell: bash |
| 39 | + env: |
| 40 | + VERSION: ${{ inputs.version }} |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + if [ -n "$VERSION" ]; then |
| 44 | + scripts/build.sh --version "$VERSION" CC=gcc CXX=g++ |
| 45 | + else |
| 46 | + scripts/build.sh CC=gcc CXX=g++ |
| 47 | + fi |
| 48 | + build/c/codebase-memory-mcp --version |
| 49 | +
|
| 50 | + - name: Package artifact |
| 51 | + id: package |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + set -euo pipefail |
| 55 | + SAFE_REF=$(printf '%s' "${GITHUB_REF_NAME}" | tr '/:@ ' '----' | tr -cd 'A-Za-z0-9._-') |
| 56 | + [ -n "$SAFE_REF" ] || SAFE_REF=branch |
| 57 | + ARTIFACT_BASE="codebase-memory-mcp-${SAFE_REF}-linux-amd64" |
| 58 | + mkdir -p "dist/${ARTIFACT_BASE}" |
| 59 | + cp build/c/codebase-memory-mcp LICENSE install.sh "dist/${ARTIFACT_BASE}/" |
| 60 | + scripts/gen-third-party-notices.sh "dist/${ARTIFACT_BASE}/THIRD_PARTY_NOTICES.md" |
| 61 | + tar -czf "dist/${ARTIFACT_BASE}.tar.gz" -C dist "${ARTIFACT_BASE}" |
| 62 | + sha256sum "dist/${ARTIFACT_BASE}.tar.gz" > "dist/${ARTIFACT_BASE}.tar.gz.sha256" |
| 63 | + echo "artifact_base=${ARTIFACT_BASE}" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + - name: Upload binary artifact |
| 66 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 67 | + with: |
| 68 | + name: ${{ steps.package.outputs.artifact_base }} |
| 69 | + path: | |
| 70 | + dist/${{ steps.package.outputs.artifact_base }}.tar.gz |
| 71 | + dist/${{ steps.package.outputs.artifact_base }}.tar.gz.sha256 |
| 72 | + if-no-files-found: error |
0 commit comments