Release Agent #29
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 Agent | |
| on: | |
| workflow_run: | |
| workflows: ["Release GPUI Desktop"] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Existing release tag to build, for example v1.9.1." | |
| required: true | |
| type: string | |
| channel: | |
| description: "Release channel metadata to apply." | |
| required: false | |
| default: auto | |
| type: choice | |
| options: | |
| - auto | |
| - beta | |
| - stable | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| metadata: | |
| if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v')) }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| channel: ${{ steps.meta.outputs.channel }} | |
| source_ref: ${{ steps.ref.outputs.source_ref }} | |
| steps: | |
| - name: Resolve source ref | |
| id: ref | |
| shell: bash | |
| env: | |
| DISPATCH_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || '' }} | |
| WORKFLOW_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || '' }} | |
| run: | | |
| source_ref="${DISPATCH_TAG:-$WORKFLOW_TAG}" | |
| echo "source_ref=$source_ref" >> "$GITHUB_OUTPUT" | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.ref.outputs.source_ref }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Resolve release metadata | |
| id: meta | |
| shell: bash | |
| env: | |
| RELEASE_NOTES_PATH: dist/release-notes.md | |
| run: | | |
| mkdir -p dist | |
| requested_channel="${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'auto' }}" | |
| node apps/desktop/scripts/release/prepare-release.mjs "${{ steps.ref.outputs.source_ref }}" "${requested_channel}" | |
| build: | |
| needs: metadata | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - id: macos-aarch64 | |
| os: macos-26 | |
| target: aarch64-apple-darwin | |
| - id: macos-x86_64 | |
| os: macos-26 | |
| target: x86_64-apple-darwin | |
| - id: linux-x86_64 | |
| os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| linux_docker_platform: linux/amd64 | |
| - id: windows-x86_64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - id: linux-aarch64 | |
| os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| linux_docker_platform: linux/arm64 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CARGO_BUILD_TARGET: ${{ matrix.target }} | |
| RELEASE_BUILD_ID: ${{ matrix.id }} | |
| RELEASE_STAGE_DIR: release-artifacts | |
| RELEASE_VERSION: ${{ needs.metadata.outputs.version }} | |
| LINUX_DOCKER_PLATFORM: ${{ matrix.linux_docker_platform }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.metadata.outputs.source_ref }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install Rust | |
| if: runner.os != 'Linux' | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Restore Rust cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: agent-rust-release-${{ runner.os }}-${{ matrix.id }}-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| agent-rust-release-${{ runner.os }}-${{ matrix.id }}- | |
| agent-rust-release-${{ runner.os }}- | |
| - name: Apply release version | |
| shell: bash | |
| env: | |
| RELEASE_NOTES_PATH: dist/release-notes.md | |
| run: | | |
| mkdir -p dist | |
| node apps/desktop/scripts/release/prepare-release.mjs "${{ needs.metadata.outputs.source_ref }}" "${{ needs.metadata.outputs.channel }}" | |
| - name: Build Linux agent on Debian 10 baseline | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| docker run --rm \ | |
| --platform "${LINUX_DOCKER_PLATFORM}" \ | |
| -v "$PWD:/workspace" \ | |
| -w /workspace \ | |
| -e CARGO_BUILD_TARGET="${CARGO_BUILD_TARGET}" \ | |
| -e CARGO_HOME=/workspace/target/linux-release-cargo-home \ | |
| debian:10 \ | |
| bash -lc ' | |
| set -euo pipefail | |
| if ! apt-get update; then | |
| sed -i \ | |
| -e "s|deb.debian.org/debian|archive.debian.org/debian|g" \ | |
| -e "s|security.debian.org/debian-security|archive.debian.org/debian-security|g" \ | |
| /etc/apt/sources.list | |
| printf "Acquire::Check-Valid-Until \"false\";\n" >/etc/apt/apt.conf.d/99no-check-valid | |
| apt-get update | |
| fi | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | |
| ca-certificates curl git build-essential cmake pkg-config perl python3 file | |
| curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable | |
| . "$CARGO_HOME/env" | |
| rustup target add "$CARGO_BUILD_TARGET" | |
| cargo build -p codux-agent --release --target "$CARGO_BUILD_TARGET" | |
| ' | |
| sudo chown -R "$(id -u):$(id -g)" target | |
| - name: Build agent | |
| if: runner.os != 'Linux' | |
| shell: bash | |
| run: cargo build -p codux-agent --release --target "${CARGO_BUILD_TARGET}" | |
| - name: Package agent | |
| shell: bash | |
| run: node apps/agent/scripts/release/package-agent.mjs | |
| - name: Upload agent artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-${{ matrix.id }} | |
| path: release-artifacts/${{ matrix.id }}/* | |
| if-no-files-found: error | |
| - name: Save Rust cache | |
| if: always() | |
| continue-on-error: true | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: agent-rust-release-${{ runner.os }}-${{ matrix.id }}-${{ hashFiles('Cargo.lock') }}-${{ github.run_id }} | |
| publish: | |
| needs: | |
| - metadata | |
| - build | |
| runs-on: ubuntu-latest | |
| env: | |
| RELEASE_VERSION: ${{ needs.metadata.outputs.version }} | |
| RELEASE_TAG: ${{ needs.metadata.outputs.source_ref }} | |
| RELEASE_ARTIFACTS_DIR: release-artifacts | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.metadata.outputs.source_ref }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Download agent artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: agent-* | |
| path: release-artifacts | |
| merge-multiple: true | |
| - name: Publish agent assets | |
| run: node apps/agent/scripts/release/publish-agent-release.mjs |