Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/aws-api-mcp-upgrade-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
name: AWS API MCP Server - Upgrade AWS CLI Version
description: |
This workflow upgrades the AWS CLI version in src/aws-api-mcp-server using uv upgrade
and creates a pull request with the changes.
on:
workflow_dispatch:
schedule:
- cron: '0 5 * * *' # Daily at 6 AM Amsterdam time (UTC+1)
env:
BOT_USER_EMAIL: ${{ vars.BOT_USER_EMAIL || '203918161+awslabs-mcp@users.noreply.github.com' }}
BOT_USER_NAME: ${{ vars.BOT_USER_NAME || 'awslabs-mcp' }}
permissions:
actions: none
attestations: none
checks: none
contents: none
deployments: none
discussions: none
id-token: none
issues: none
models: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
upgrade-awscli:
name: Upgrade AWS CLI Version
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write # SECURITY: Only for branch creation and commits
pull-requests: write # SECURITY: Only for PR creation
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
- name: Create upgrade branch
id: create-branch
run: |
set -euo pipefail

TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
UPGRADE_BRANCH="upgrade/aws-api-mcp-awscli-$TIMESTAMP"

git config --local user.email "${{ env.BOT_USER_EMAIL }}"
git config --local user.name "${{ env.BOT_USER_NAME }}"

git checkout -b "$UPGRADE_BRANCH"
git push --set-upstream origin "$UPGRADE_BRANCH"

echo "upgrade-branch=$UPGRADE_BRANCH" >> $GITHUB_OUTPUT
- name: Upgrade AWS CLI in aws-api-mcp-server
working-directory: src/aws-api-mcp-server
run: |
set -euo pipefail

echo "::debug::Upgrading AWS CLI dependencies"
uv remove awscli
uv add awscli --upgrade
uv sync
- name: Configure Git and GPG securely
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
set -euo pipefail # SECURITY: Strict error handling

# Create secure temporary directory for GPG
export GNUPGHOME=$(mktemp -d)
chmod 700 "$GNUPGHOME"
echo "GNUPGHOME=$GNUPGHOME" >> $GITHUB_ENV

echo "::debug::Setting up secure GPG environment"

# Configure git user
git config --local user.email "${{ env.BOT_USER_EMAIL }}"
git config --local user.name "${{ env.BOT_USER_NAME }}"

# Import GPG key without exposing secrets in command line
echo "$GPG_PRIVATE_KEY" | gpg --batch --import --quiet
echo "$GPG_KEY_ID:6:" | gpg --import-ownertrust --quiet

# Configure git GPG settings
git config --global user.signingkey "$GPG_KEY_ID"
git config --global commit.gpgsign true
git config --global tag.gpgsign true

# Test GPG functionality
echo "test" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
--sign --armor --local-user "$GPG_KEY_ID" <<< "$GPG_PASSPHRASE" > /dev/null

echo "::debug::GPG configuration completed successfully"
- name: Commit and push changes
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
set -euo pipefail
echo "::debug::Committing changes"

# Add only the source directory
git add src/aws-api-mcp-server/

# Check if there are changes to commit
if git diff --cached --quiet; then
echo "::warning::No changes to commit"
exit 0
else
# Cache GPG signature
echo "commit" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
--sign --armor --local-user "$GPG_KEY_ID" <<< "$GPG_PASSPHRASE" > /dev/null

# Create signed commit
git commit -m "chore(aws-api-mcp-server): upgrade AWS CLI version" --sign

# Pull with rebase to maintain linear history
git pull --rebase origin "${{ steps.create-branch.outputs.upgrade-branch }}"

# Push changes
git push origin "${{ steps.create-branch.outputs.upgrade-branch }}"

echo "::debug::Successfully committed and pushed changes"
fi
- name: Create pull request
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
set -euo pipefail

UPGRADE_BRANCH="${{ steps.create-branch.outputs.upgrade-branch }}"
BASE_BRANCH="${{ github.ref_name }}"

PR_URL="$(gh pr create \
--base "$BASE_BRANCH" \
--head "$UPGRADE_BRANCH" \
--title "chore(aws-api-mcp-server): upgrade AWS CLI version" \
--body "# AWS CLI Version Upgrade

This PR upgrades the AWS CLI version in the aws-api-mcp-server package.

## Changes
* Updated AWS CLI dependencies using \`uv sync --upgrade-package awscli\`

## Checklist
- [ ] Dependencies have been upgraded
- [ ] Lock file has been updated
- [ ] Tests pass with new versions

## Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the [project license](https://github.com/awslabs/mcp/blob/main/LICENSE).")"

echo "::debug::Successfully created pull request $PR_URL"
echo "### :arrow_up: AWS CLI Upgrade Ready" >> $GITHUB_STEP_SUMMARY
echo "Pull request $PR_URL created for [$UPGRADE_BRANCH](https://github.com/${{ github.repository }}/tree/$UPGRADE_BRANCH) branch" >> $GITHUB_STEP_SUMMARY
- name: Secure GPG cleanup
if: always()
run: |
set +e # Don't fail on cleanup errors
echo "::debug::Performing secure cleanup"
if [[ -n "${GNUPGHOME:-}" && -d "$GNUPGHOME" ]]; then
rm -rf "$GNUPGHOME"
echo "::debug::Cleaned up GPG directory"
fi
gpgconf --kill gpg-agent 2>/dev/null || true
unset GPG_PRIVATE_KEY GPG_PASSPHRASE GPG_KEY_ID GNUPGHOME 2>/dev/null || true
echo "::debug::Secure cleanup completed"
2 changes: 1 addition & 1 deletion src/aws-api-mcp-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ requires-python = ">=3.10"
dependencies = [
"mcp>=1.11.0",
"pydantic>=2.10.6",
"awscli==1.42.40",
"boto3>=1.38.18",
"botocore>=1.38.18",
"python-json-logger>=2.0.7",
Expand All @@ -20,6 +19,7 @@ dependencies = [
"importlib_resources>=6.0.0",
"requests>=2.32.4",
"python-frontmatter>=1.1.0",
"awscli>=1.42.44",
]
license = {text = "Apache-2.0"}
license-files = ["LICENSE", "NOTICE" ]
Expand Down
Loading
Loading