Same fix as release.yml -- replaced step outputs with GITHUB_ENV variables to avoid the act runner format bug. Also removed the has_changes conditional since sidecar-release is now manual-only (workflow_dispatch always means we want to build). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
103 lines
3.8 KiB
YAML
103 lines
3.8 KiB
YAML
name: Sidecar Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
run: |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Python tests
|
|
run: |
|
|
uv venv .testvenv
|
|
VIRTUAL_ENV=.testvenv uv pip install pytest httpx pytest-asyncio anyio fastapi pydantic pyyaml uvicorn requests
|
|
.testvenv/bin/python -m pytest backend/tests/ client/tests/ -v --tb=short
|
|
|
|
bump-sidecar-version:
|
|
name: Bump sidecar version and tag
|
|
needs: test
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
|
|
- name: Bump sidecar patch version
|
|
run: |
|
|
CURRENT=$(grep '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
|
echo "Current sidecar version: ${CURRENT}"
|
|
|
|
MAJOR=$(echo "${CURRENT}" | cut -d. -f1)
|
|
MINOR=$(echo "${CURRENT}" | cut -d. -f2)
|
|
PATCH=$(echo "${CURRENT}" | cut -d. -f3)
|
|
NEW_PATCH=$((PATCH + 1))
|
|
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
|
echo "New sidecar version: ${NEW_VERSION}"
|
|
|
|
sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" pyproject.toml
|
|
|
|
# Write to env file instead of step outputs (avoids act runner bug)
|
|
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
|
|
echo "RELEASE_TAG=sidecar-v${NEW_VERSION}" >> $GITHUB_ENV
|
|
|
|
- name: Commit and tag
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
git add pyproject.toml
|
|
git commit -m "chore: bump sidecar version to ${NEW_VERSION} [skip ci]"
|
|
git tag "${RELEASE_TAG}"
|
|
|
|
REMOTE_URL=$(git remote get-url origin | sed "s|://|://gitea-actions:${BUILD_TOKEN}@|")
|
|
git pull --rebase "${REMOTE_URL}" main || true
|
|
git push "${REMOTE_URL}" HEAD:main
|
|
git push "${REMOTE_URL}" "${RELEASE_TAG}"
|
|
|
|
- name: Create Gitea release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
RELEASE_NAME="Sidecar v${NEW_VERSION}"
|
|
|
|
curl -s -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"${RELEASE_TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated sidecar build.\", \"draft\": false, \"prerelease\": false}" \
|
|
"${REPO_API}/releases"
|
|
echo "Created release: ${RELEASE_NAME}"
|
|
|
|
- name: Trigger per-OS sidecar builds
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
|
|
for workflow in build-sidecar-linux.yml build-sidecar-windows.yml build-sidecar-macos.yml build-sidecar-cloud.yml; do
|
|
echo "Dispatching ${workflow} for ${RELEASE_TAG}..."
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"ref\": \"main\", \"inputs\": {\"tag\": \"${RELEASE_TAG}\"}}" \
|
|
"${REPO_API}/actions/workflows/${workflow}/dispatches")
|
|
echo " -> HTTP ${HTTP_CODE}"
|
|
done
|
|
|
|
# NOTE: Automatic cleanup disabled -- it races with async builds.
|
|
# Clean up old releases manually from the Gitea UI when needed.
|