WSO2 AI Agent Management Platform Release #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WSO2 AI Agent Management Platform Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| source-ref: | |
| description: "Source ref to create release from (branch name or commit SHA)" | |
| 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: wso2 | |
| HELM_REGISTRY: oci://ghcr.io/wso2 | |
| 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 | |
| id: validate | |
| run: | | |
| # Validate target-release format | |
| if [[ ! "${{ inputs.target-release }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
| echo "Error: Invalid target-release format. Expected: X.Y.Z" | |
| exit 1 | |
| fi | |
| # Determine if source-ref is a commit SHA or branch name | |
| SOURCE_REF="${{ inputs.source-ref }}" | |
| if [[ "$SOURCE_REF" =~ ^[0-9a-f]{7,40}$ ]]; then | |
| echo "source-type=commit" >> $GITHUB_OUTPUT | |
| echo "✅ Source ref is a commit SHA: $SOURCE_REF" | |
| else | |
| echo "source-type=branch" >> $GITHUB_OUTPUT | |
| echo "✅ Source ref is a branch: $SOURCE_REF" | |
| fi | |
| echo "source-ref=$SOURCE_REF" >> $GITHUB_OUTPUT | |
| echo "✅ Inputs validated" | |
| shell: bash | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| persist-credentials: true | |
| fetch-depth: 0 | |
| ref: ${{ steps.validate.outputs.source-ref }} | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| shell: bash | |
| - name: Verify source commit | |
| id: verify-commit | |
| run: | | |
| SOURCE_REF="${{ steps.validate.outputs.source-ref }}" | |
| SOURCE_TYPE="${{ steps.validate.outputs.source-type }}" | |
| # Get the commit SHA for the source ref | |
| COMMIT_SHA=$(git rev-parse HEAD) | |
| echo "commit-sha=$COMMIT_SHA" >> $GITHUB_OUTPUT | |
| if [ "$SOURCE_TYPE" = "commit" ]; then | |
| echo "✅ Using commit: $COMMIT_SHA" | |
| echo "📝 Short SHA: ${COMMIT_SHA:0:7}" | |
| else | |
| echo "✅ Using branch '$SOURCE_REF' at commit: $COMMIT_SHA" | |
| echo "📝 Short SHA: ${COMMIT_SHA:0:7}" | |
| fi | |
| shell: bash | |
| - name: Create release branch | |
| id: create-branch | |
| run: | | |
| BRANCH_NAME="amp-${{ inputs.target-release }}" | |
| COMMIT_SHA="${{ steps.verify-commit.outputs.commit-sha }}" | |
| # Check if branch already exists | |
| if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then | |
| echo "Branch $BRANCH_NAME already exists" | |
| git checkout "$BRANCH_NAME" | |
| # Reset to the source commit | |
| git reset --hard "$COMMIT_SHA" | |
| echo "✅ Reset existing branch to commit ${COMMIT_SHA:0:7}" | |
| else | |
| # Create new branch from the source commit | |
| git checkout -b "$BRANCH_NAME" | |
| echo "✅ Created new branch from commit ${COMMIT_SHA:0:7}" | |
| fi | |
| echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| echo "✅ Release 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 }}" \ | |
| "./deployments/quick-start/install-helpers.sh" | |
| shell: bash | |
| - name: Commit version updates | |
| id: commit-changes | |
| run: | | |
| git add "./deployments/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 }}" | |
| COMMIT_SHA="${{ steps.verify-commit.outputs.commit-sha }}" | |
| SOURCE_TYPE="${{ steps.validate.outputs.source-type }}" | |
| # Create tag message with source information | |
| if [ "$SOURCE_TYPE" = "commit" ]; then | |
| TAG_MESSAGE="Release $TAG from commit ${COMMIT_SHA:0:7}" | |
| else | |
| TAG_MESSAGE="Release $TAG from branch ${{ steps.validate.outputs.source-ref }} at commit ${COMMIT_SHA:0:7}" | |
| fi | |
| # Create new tag | |
| git tag -a "$TAG" -m "$TAG_MESSAGE" | |
| git push origin "$TAG" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "✅ Created and pushed tag: $TAG" | |
| echo "📝 Source: $TAG_MESSAGE" | |
| # 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 | |
| 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: Get source commit info | |
| id: commit-info | |
| run: | | |
| COMMIT_SHA=$(git rev-parse amp/v${{ inputs.target-release }}^{commit}) | |
| SHORT_SHA=${COMMIT_SHA:0:7} | |
| echo "commit-sha=$COMMIT_SHA" >> $GITHUB_OUTPUT | |
| echo "short-sha=$SHORT_SHA" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - 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 }} |