| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- name: Companion Release
- on:
- workflow_dispatch:
- inputs:
- version:
- description: 'Companion version, for example 0.1.0'
- required: true
- type: string
- targets:
- description: >-
- Comma-separated targets to build: macos-arm64,macos-x64,linux-x64,linux-arm64,windows-x64
- required: true
- default: macos-arm64
- type: string
- permissions:
- contents: write
- jobs:
- macos-arm64:
- name: macOS arm64
- if: contains(github.event.inputs.targets, 'macos-arm64')
- runs-on: macos-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: aarch64-apple-darwin
- - name: Build companion
- working-directory: companion
- run: cargo build --release --target aarch64-apple-darwin
- - name: Package companion
- run: |
- set -euo pipefail
- version='${{ github.event.inputs.version }}'
- target='aarch64-apple-darwin'
- name="oh-my-opencode-slim-companion-v${version}-${target}"
- mkdir -p dist
- cp "companion/target/${target}/release/oh-my-opencode-slim-companion" dist/oh-my-opencode-slim-companion
- tar -C dist -czf "${name}.tar.gz" oh-my-opencode-slim-companion
- - uses: actions/upload-artifact@v4
- with:
- name: companion-macos-arm64
- path: '*.tar.gz'
- macos-x64:
- name: macOS x64
- if: contains(github.event.inputs.targets, 'macos-x64')
- runs-on: macos-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: x86_64-apple-darwin
- - name: Build companion
- working-directory: companion
- run: cargo build --release --target x86_64-apple-darwin
- - name: Package companion
- run: |
- set -euo pipefail
- version='${{ github.event.inputs.version }}'
- target='x86_64-apple-darwin'
- name="oh-my-opencode-slim-companion-v${version}-${target}"
- mkdir -p dist
- cp "companion/target/${target}/release/oh-my-opencode-slim-companion" dist/oh-my-opencode-slim-companion
- tar -C dist -czf "${name}.tar.gz" oh-my-opencode-slim-companion
- - uses: actions/upload-artifact@v4
- with:
- name: companion-macos-x64
- path: '*.tar.gz'
- linux-x64:
- name: Linux x64
- if: contains(github.event.inputs.targets, 'linux-x64')
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: x86_64-unknown-linux-gnu
- - name: Install system dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- - name: Build companion
- working-directory: companion
- run: cargo build --release --target x86_64-unknown-linux-gnu
- - name: Package companion
- run: |
- set -euo pipefail
- version='${{ github.event.inputs.version }}'
- target='x86_64-unknown-linux-gnu'
- name="oh-my-opencode-slim-companion-v${version}-${target}"
- mkdir -p dist
- cp "companion/target/${target}/release/oh-my-opencode-slim-companion" dist/oh-my-opencode-slim-companion
- tar -C dist -czf "${name}.tar.gz" oh-my-opencode-slim-companion
- - uses: actions/upload-artifact@v4
- with:
- name: companion-linux-x64
- path: '*.tar.gz'
- linux-arm64:
- name: Linux arm64
- if: contains(github.event.inputs.targets, 'linux-arm64')
- runs-on: ubuntu-24.04-arm
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: aarch64-unknown-linux-gnu
- - name: Install system dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- - name: Build companion
- working-directory: companion
- run: cargo build --release --target aarch64-unknown-linux-gnu
- - name: Package companion
- run: |
- set -euo pipefail
- version='${{ github.event.inputs.version }}'
- target='aarch64-unknown-linux-gnu'
- name="oh-my-opencode-slim-companion-v${version}-${target}"
- mkdir -p dist
- cp "companion/target/${target}/release/oh-my-opencode-slim-companion" dist/oh-my-opencode-slim-companion
- tar -C dist -czf "${name}.tar.gz" oh-my-opencode-slim-companion
- - uses: actions/upload-artifact@v4
- with:
- name: companion-linux-arm64
- path: '*.tar.gz'
- windows-x64:
- name: Windows x64
- if: contains(github.event.inputs.targets, 'windows-x64')
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: x86_64-pc-windows-msvc
- - name: Build companion
- working-directory: companion
- run: cargo build --release --target x86_64-pc-windows-msvc
- - name: Package companion
- shell: pwsh
- run: |
- $version = '${{ github.event.inputs.version }}'
- $target = 'x86_64-pc-windows-msvc'
- $name = "oh-my-opencode-slim-companion-v$version-$target"
- New-Item -ItemType Directory -Force -Path dist | Out-Null
- Copy-Item "companion/target/$target/release/oh-my-opencode-slim-companion.exe" "dist/oh-my-opencode-slim-companion.exe"
- Compress-Archive -Path "dist/oh-my-opencode-slim-companion.exe" -DestinationPath "$name.zip" -Force
- - uses: actions/upload-artifact@v4
- with:
- name: companion-windows-x64
- path: '*.zip'
- release:
- name: Publish companion release
- needs:
- - macos-arm64
- - macos-x64
- - linux-x64
- - linux-arm64
- - windows-x64
- if: always() && !cancelled() && !failure()
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/download-artifact@v4
- with:
- path: artifacts
- merge-multiple: true
- - name: Create or update GitHub release
- env:
- GH_TOKEN: ${{ github.token }}
- VERSION: ${{ github.event.inputs.version }}
- run: |
- set -euo pipefail
- tag="companion-v${VERSION}"
- if ! gh release view "$tag" >/dev/null 2>&1; then
- gh release create "$tag" \
- --title "Companion v${VERSION}" \
- --notes "Manual companion binary release for oh-my-opencode-slim."
- fi
- gh release upload "$tag" artifacts/* --clobber
|