Files
mistral-vibe/.github/workflows/build-and-upload.yml
Quentin d8dbeeb31e v1.2.0
Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Kracekumar <kracethekingmaker@gmail.com>
2025-12-18 17:49:14 +01:00

125 lines
4.5 KiB
YAML

name: Build and upload
on:
release:
types: [published]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set matrix
id: set-matrix
run: |
if [[ "${{ github.repository }}" == "mistralai/mistral-vibe" ]]; then
matrix='{
"include": [
{"runner": "ubuntu-22.04", "os": "linux", "arch": "x86_64"},
{"runner": "ubuntu-22.04-arm", "os": "linux", "arch": "aarch64"},
{"runner": "macos-15-intel", "os": "darwin", "arch": "x86_64"},
{"runner": "macos-14", "os": "darwin", "arch": "aarch64"},
{"runner": "windows-2022", "os": "windows", "arch": "x86_64"},
{"runner": "windows-11-arm", "os": "windows", "arch": "aarch64"}
]
}'
else # skip ARM Linux/Windows (runners not available on non public repos)
matrix='{
"include": [
{"runner": "ubuntu-22.04", "os": "linux", "arch": "x86_64"},
{"runner": "macos-15-intel", "os": "darwin", "arch": "x86_64"},
{"runner": "macos-14", "os": "darwin", "arch": "aarch64"},
{"runner": "windows-2022", "os": "windows", "arch": "x86_64"}
]
}'
fi
echo "matrix=$(echo $matrix | jq -c .)" >> $GITHUB_OUTPUT
build-and-upload:
needs: configure
name: ${{ matrix.os }}-${{ matrix.arch }}
strategy:
matrix: ${{ fromJSON(needs.configure.outputs.matrix) }}
runs-on: ${{ matrix.runner }}
steps:
- name: echo
run: echo github.repository=${{ github.repository }}
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv with caching
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Sync dependencies
run: uv sync --no-dev --group build
- name: Build with PyInstaller
run: uv run --no-dev --group build pyinstaller vibe-acp.spec
- name: Get package version with uv (Unix)
id: get_version_unix
if: ${{ matrix.os != 'windows' }}
run: python -c "import subprocess; version = subprocess.check_output(['uv', 'version']).decode().split()[1]; print(f'version={version}')" >> $GITHUB_OUTPUT
- name: Get package version with uv (Windows)
id: get_version_windows
if: ${{ matrix.os == 'windows' }}
shell: pwsh
run: python -c "import subprocess; version = subprocess.check_output(['uv', 'version']).decode().split()[1]; print(f'version={version}')" >> $env:GITHUB_OUTPUT
- name: Upload binary as artifact (Unix)
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
if: ${{ matrix.os != 'windows' }}
with:
name: vibe-acp-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_unix.outputs.version }}
path: dist/vibe-acp
- name: Upload binary as artifact (Windows)
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
if: ${{ matrix.os == 'windows' }}
with:
name: vibe-acp-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_windows.outputs.version }}
path: dist/vibe-acp.exe
attach-to-release:
needs: build-and-upload
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
with:
path: artifacts
- name: Zip artifacts like GitHub UI
run: |
mkdir release-assets
for dir in artifacts/*; do
name=$(basename "$dir")
(cd artifacts && zip -r "../release-assets/${name}.zip" "$name")
done
- name: Attach binaries to release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
files: release-assets/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}