Skip to content

WSO2 AI Agent Management Platform Release #8

WSO2 AI Agent Management Platform Release

WSO2 AI Agent Management Platform Release #8

Workflow file for this run

name: WSO2 AI Agent Management Platform Release
on:
workflow_dispatch:
inputs:
branch:
description: "Source branch to create release from"
required: false
default: "main"
type: string
target-release:
description: "Target release version (e.g., 0.0.1)"
required: true
type: string
env:
REGISTRY: ghcr.io
REGISTRY_ORG: hanzjk
HELM_REGISTRY: oci://ghcr.io/hanzjk
jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
concurrency:
group: release-${{ inputs.target-release }}
cancel-in-progress: false
permissions:
contents: write
packages: write
steps:
- name: Validate inputs
run: |
if [[ ! "${{ inputs.target-release }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Error: Invalid target-release format. Expected: X.Y.Z"
exit 1
fi
echo "✅ Inputs validated"
shell: bash
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
fetch-depth: 0
ref: ${{ inputs.branch }}
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
shell: bash
- name: Create release branch
id: create-branch
run: |
BRANCH_NAME="amp-${{ inputs.target-release }}"
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME already exists, checking it out"
git checkout "$BRANCH_NAME"
else
git checkout -b "$BRANCH_NAME"
fi
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "✅ Created/checked out branch: $BRANCH_NAME"
shell: bash
- name: Update Helm chart versions
run: |
bash .github/scripts/update-helm-charts.sh \
"${{ inputs.target-release }}"
shell: bash
- name: Update docs versions
run: |
bash .github/scripts/update-docs-versions.sh \
"${{ inputs.target-release }}"
shell: bash
- name: Update install-helpers.sh
run: |
bash .github/scripts/update-install-helpers.sh \
"${{ inputs.target-release }}" \
"./quick-start/install-helpers.sh"
shell: bash
- name: Commit version updates
id: commit-changes
run: |
git add "./quick-start/install-helpers.sh" "./deployments/helm-charts/*/Chart.yaml" "./deployments/helm-charts/*/values.yaml" "./docs/quick-start.md" "./docs/install/single-cluster.md" 2>/dev/null || true
if git diff --staged --quiet; then
echo "No changes to commit"
echo "committed=false" >> $GITHUB_OUTPUT
else
git commit -m "chore: update versions for release amp/v${{ inputs.target-release }}"
echo "committed=true" >> $GITHUB_OUTPUT
echo "✅ Committed version updates"
fi
shell: bash
- name: Create git tag
id: create-tag
run: |
TAG="amp/v${{ inputs.target-release }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, deleting and recreating..."
git tag -d "$TAG" || true
git push origin ":refs/tags/$TAG" || true
fi
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "✅ Created and pushed tag: $TAG"
# Extract major version and create/update major version tag
MAJOR_VERSION=$(echo "${{ inputs.target-release }}" | cut -d. -f1)
MAJOR_TAG="amp/v${MAJOR_VERSION}"
echo "Creating/updating major version tag: $MAJOR_TAG"
if git rev-parse "$MAJOR_TAG" >/dev/null 2>&1; then
echo "Major tag $MAJOR_TAG already exists, updating..."
git tag -d "$MAJOR_TAG" || true
git push origin ":refs/tags/$MAJOR_TAG" || true
fi
git tag -a "$MAJOR_TAG" -m "Latest release for major version $MAJOR_VERSION"
git push origin "$MAJOR_TAG"
echo "✅ Created/updated major version tag: $MAJOR_TAG"
shell: bash
- name: Push branch
if: steps.commit-changes.outputs.committed == 'true'
run: |
git push origin "${{ steps.create-branch.outputs.branch }}"
echo "✅ Pushed branch"
shell: bash
load-config:
name: Load Release Configuration
needs: prepare-release
runs-on: ubuntu-latest
outputs:
images: ${{ steps.set-matrix.outputs.images }}
python-versions: ${{ steps.set-matrix.outputs.python-versions }}
charts: ${{ steps.set-matrix.outputs.charts }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: amp/v${{ inputs.target-release }}
- name: Load configuration and set matrix
id: set-matrix
run: |
CONFIG_FILE=".github/release-config.json"
# Read base configuration
CHARTS_BASE_PATH=$(jq -r '.config["charts-base-path"]' "$CONFIG_FILE")
# Expand images configuration (add resolved paths)
IMAGES=$(jq -c --arg base "$CHARTS_BASE_PATH" '[.images[] | {
name: .name,
"service-dir": .dir,
dockerfile: (.dir + "/Dockerfile")
}]' "$CONFIG_FILE")
# Expand charts configuration (add resolved paths)
CHARTS=$(jq -c --arg base "$CHARTS_BASE_PATH" '[.charts[] | {
name: .,
path: ($base + "/" + .),
"chart-file": ($base + "/" + . + "/Chart.yaml")
}]' "$CONFIG_FILE")
# Extract Python versions from python-instrumentation-provider
PYTHON_VERSIONS=$(jq -c '[.["python-instrumentation-provider"][0].versions[]]' "$CONFIG_FILE")
echo "images=$IMAGES" >> $GITHUB_OUTPUT
echo "python-versions=$PYTHON_VERSIONS" >> $GITHUB_OUTPUT
echo "charts=$CHARTS" >> $GITHUB_OUTPUT
echo "✅ Loaded configuration:"
echo " - Images: $(echo "$IMAGES" | jq '. | length')"
echo " - Python Versions: $(echo "$PYTHON_VERSIONS" | jq '. | length')"
echo " - Charts: $(echo "$CHARTS" | jq '. | length')"
shell: bash
build-images:
name: Build ${{ matrix.image.name }}
needs: load-config
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
image: ${{ fromJson(needs.load-config.outputs.images) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: amp/v${{ inputs.target-release }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.image.name }}
if: hashFiles(matrix.image.dockerfile) != ''
uses: ./.github/actions/build-docker-image
with:
service-dir: ${{ matrix.image.service-dir }}
image-name: ${{ matrix.image.name }}
registry: ${{ env.REGISTRY }}
registry-org: ${{ env.REGISTRY_ORG }}
tag: v${{ inputs.target-release }}
build-python-instrumentation-provider-images:
name: Build Instrumentation Provider Python ${{ matrix.python-version }}
needs: load-config
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
python-version: ${{ fromJson(needs.load-config.outputs.python-versions) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: amp/v${{ inputs.target-release }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Python ${{ matrix.python-version }} image
uses: ./.github/actions/build-single-platform-docker-image
with:
service-dir: python-instrumentation-provider
image-name: amp-python-instrumentation-provider
registry: ${{ env.REGISTRY }}
registry-org: ${{ env.REGISTRY_ORG }}
tag: v${{ inputs.target-release }}-python${{ matrix.python-version }}
platform: linux/amd64
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
package-charts:
name: Package ${{ matrix.chart.name }}
needs:
[load-config, build-images, build-python-instrumentation-provider-images]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
chart: ${{ fromJson(needs.load-config.outputs.charts) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: amp/v${{ inputs.target-release }}
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: "3.14.0"
- name: Package and push ${{ matrix.chart.name }}
if: hashFiles(matrix.chart.chart-file) != ''
run: |
bash .github/scripts/package-helm-chart.sh \
"${{ matrix.chart.path }}" \
"${{ inputs.target-release }}" \
"${{ env.HELM_REGISTRY }}" \
"${{ secrets.GITHUB_TOKEN }}"
shell: bash
create-release:
name: Create Release
needs:
[
prepare-release,
build-images,
build-python-instrumentation-provider-images,
package-charts,
]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: amp/v${{ inputs.target-release }}
- name: Create GitHub release
id: create-release
uses: softprops/action-gh-release@v2
with:
tag_name: amp/v${{ inputs.target-release }}
name: Release amp/v${{ inputs.target-release }}
body: |
## Release amp/v${{ inputs.target-release }}
### Docker Images
- `${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/amp-console:v${{ inputs.target-release }}`
- `${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/amp-api:v${{ inputs.target-release }}`
- `${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/amp-traces-observer:v${{ inputs.target-release }}`
- `${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/amp-python-instrumentation-provider:v${{ inputs.target-release }}`
- `${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/amp-quick-start:v${{ inputs.target-release }}`
### Helm Charts
- `${{ env.HELM_REGISTRY }}/wso2-ai-agent-management-platform:${{ inputs.target-release }}`
- `${{ env.HELM_REGISTRY }}/wso2-amp-build-extension:${{ inputs.target-release }}`
- `${{ env.HELM_REGISTRY }}/wso2-amp-observability-extension:${{ inputs.target-release }}`
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}