Skip to content

Revert version

Revert version #6

Workflow file for this run

name: Sync Version
# Prevent concurrent runs to avoid push conflicts
concurrency:
group: sync-version-${{ github.ref }}
cancel-in-progress: false
on:
# Run manually before releasing
workflow_dispatch:
inputs:
version:
description: 'Version to sync (leave empty to read from pyproject.toml)'
required: false
type: string
# Or automatically when pyproject.toml changes
push:
branches:
- master
paths:
- 'pyproject.toml'
permissions:
contents: write
jobs:
sync-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Get version from pyproject.toml
id: get_version
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
fi
if [ -z "${VERSION}" ]; then
echo "ERROR: Failed to extract version from pyproject.toml"
exit 1
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Syncing version: ${VERSION}"
- name: Update Dockerfile
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Update OCI image version label
sed -i "s/org.opencontainers.image.version=\"[^\"]*\"/org.opencontainers.image.version=\"${VERSION}\"/" docker/Dockerfile
- name: Update docker-compose.yml
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Update version label default
sed -i "s/com.mcp-jenkins.version=\${VERSION:-[^}]*}/com.mcp-jenkins.version=\${VERSION:-${VERSION}}/" docker/docker-compose.yml
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No version changes needed"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changes detected:"
git diff
fi
- name: Commit and push
if: steps.changes.outputs.changed == 'true'
run: |
VERSION="${{ steps.get_version.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docker/Dockerfile docker/docker-compose.yml
git commit -m "chore: Sync version to ${VERSION}"
git push