From 985b7f74e6e685313236d8a5ab007c69879f18dd Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 6 Apr 2026 00:37:35 +0300 Subject: [PATCH] ci: add manual artifact build workflow --- .github/workflows/build-artifacts-manual.yml | 110 +++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/build-artifacts-manual.yml diff --git a/.github/workflows/build-artifacts-manual.yml b/.github/workflows/build-artifacts-manual.yml new file mode 100644 index 00000000..873f03a4 --- /dev/null +++ b/.github/workflows/build-artifacts-manual.yml @@ -0,0 +1,110 @@ +name: Build artifacts (manual) + +on: + workflow_dispatch: + inputs: + build_group: + description: which artifacts to build + required: true + default: linux + type: choice + options: + - linux + - macos + - all + libghostty_optimize: + description: libghostty-vt optimize mode for this build + required: true + default: ReleaseSafe + type: choice + options: + - ReleaseSafe + - ReleaseFast + - ReleaseSmall + - Debug + +permissions: + contents: read + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + name: herdr-linux-x86_64 + group: linux + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + name: herdr-linux-aarch64 + group: linux + - target: x86_64-apple-darwin + os: macos-latest + name: herdr-macos-x86_64 + group: macos + - target: aarch64-apple-darwin + os: macos-latest + name: herdr-macos-aarch64 + group: macos + + if: ${{ inputs.build_group == 'all' || inputs.build_group == matrix.group }} + runs-on: ${{ matrix.os }} + env: + LIBGHOSTTY_VT_OPTIMIZE: ${{ inputs.libghostty_optimize }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Install Zig + uses: mlugg/setup-zig@v2 + with: + version: 0.15.2 + + - name: Install Linux build tools + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y cmake ninja-build musl-tools gcc-aarch64-linux-gnu crossbuild-essential-arm64 + + - name: Install macOS build tools + if: runner.os == 'macOS' + run: brew install cmake ninja + + - name: Set Linux aarch64 linker + if: matrix.target == 'aarch64-unknown-linux-musl' + run: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + + - name: Remove Zig caches + run: rm -rf .zig-cache vendor/libghostty-vt/.zig-cache vendor/libghostty-vt/zig-out + + - name: Build + run: cargo build --release --locked --target ${{ matrix.target }} + + - name: Package artifact + run: | + cp target/${{ matrix.target }}/release/herdr ${{ matrix.name }} + ./${{ matrix.name }} --version + file ${{ matrix.name }} > BUILD_INFO.txt + { + echo "commit=$GITHUB_SHA" + echo "target=${{ matrix.target }}" + echo "libghostty_vt_optimize=$LIBGHOSTTY_VT_OPTIMIZE" + } >> BUILD_INFO.txt + python3 -c "import hashlib, pathlib; artifact = pathlib.Path('${{ matrix.name }}'); print(f'sha256={hashlib.sha256(artifact.read_bytes()).hexdigest()} {artifact.name}')" >> BUILD_INFO.txt + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }}-${{ inputs.libghostty_optimize }} + path: | + ${{ matrix.name }} + BUILD_INFO.txt + retention-days: 7