@@ -67,31 +67,48 @@ jobs:
6767
6868 echo "upgrade-branch=$UPGRADE_BRANCH" >> $GITHUB_OUTPUT
6969 echo "::debug::Successfully created upgrade branch: $UPGRADE_BRANCH"
70- - name : Upgrade AWS CLI in aws-api-mcp-server
70+ - name : Check and upgrade AWS CLI version
71+ id : upgrade
7172 working-directory : src/aws-api-mcp-server
7273 run : |
7374 set -euo pipefail
7475
75- echo "::debug::Upgrading AWS CLI dependencies"
76+ # Get current installed version
77+ CURRENT_VERSION=$(uv run python -c "from importlib.metadata import version; print(version('awscli'))")
78+ echo "::debug::Current AWS CLI version: $CURRENT_VERSION"
7679
7780 # Get latest version from PyPI
7881 LATEST_VERSION=$(uv run --no-project python -c "import urllib.request, json; print(json.loads(urllib.request.urlopen('https://pypi.org/pypi/awscli/json').read())['info']['version'])")
7982 echo "::debug::Latest AWS CLI version from PyPI: $LATEST_VERSION"
8083
81- # Remove existing awscli dependency
82- echo "::debug::Removing existing awscli dependency"
83- uv remove awscli
84+ # Set version outputs
85+ echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
86+ echo "latest-version=$LATEST_VERSION" >> $GITHUB_OUTPUT
8487
85- # Add new version with exact pinning
86- echo "::debug::Adding awscli==$LATEST_VERSION"
87- uv add "awscli==$LATEST_VERSION"
88+ # Compare versions
89+ if [[ "$CURRENT_VERSION" == "$LATEST_VERSION" ]]; then
90+ echo "has-changes=false" >> $GITHUB_OUTPUT
91+ echo "::notice::AWS CLI is already up to date (version $CURRENT_VERSION)"
92+ else
93+ echo "has-changes=true" >> $GITHUB_OUTPUT
94+ echo "::notice::Upgrading AWS CLI from $CURRENT_VERSION to $LATEST_VERSION"
95+
96+ # Remove existing awscli dependency
97+ echo "::debug::Removing existing awscli dependency"
98+ uv remove awscli
8899
89- # Sync dependencies
90- echo "::debug::Syncing dependencies "
91- uv sync
100+ # Add new version with exact pinning
101+ echo "::debug::Adding awscli==$LATEST_VERSION "
102+ uv add "awscli==$LATEST_VERSION"
92103
93- echo "::debug::AWS CLI upgrade completed"
104+ # Sync dependencies
105+ echo "::debug::Syncing dependencies"
106+ uv sync
107+
108+ echo "::debug::AWS CLI upgrade completed"
109+ fi
94110 - name : Configure Git and GPG securely
111+ if : steps.upgrade.outputs.has-changes == 'true'
95112 env :
96113 GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
97114 GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
@@ -125,6 +142,7 @@ jobs:
125142
126143 echo "::debug::GPG configuration completed successfully"
127144 - name : Commit and push changes
145+ if : steps.upgrade.outputs.has-changes == 'true'
128146 env :
129147 GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
130148 GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
@@ -135,27 +153,22 @@ jobs:
135153 # Add only the source directory
136154 git add src/aws-api-mcp-server/
137155
138- # Check if there are changes to commit
139- if git diff --cached --quiet; then
140- echo "::warning::No changes to commit"
141- exit 0
142- else
143- # Cache GPG signature
144- echo "commit" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
145- --sign --armor --local-user "$GPG_KEY_ID" <<< "$GPG_PASSPHRASE" > /dev/null
156+ # Cache GPG signature
157+ echo "commit" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
158+ --sign --armor --local-user "$GPG_KEY_ID" <<< "$GPG_PASSPHRASE" > /dev/null
146159
147- # Create signed commit
148- git commit -m "chore(aws-api-mcp-server): upgrade AWS CLI version" --sign
160+ # Create signed commit
161+ git commit -m "chore(aws-api-mcp-server): upgrade AWS CLI to v${{ steps.upgrade.outputs.latest- version }} " --sign
149162
150- # Pull with rebase to maintain linear history
151- git pull --rebase origin "${{ steps.create-branch.outputs.upgrade-branch }}"
163+ # Pull with rebase to maintain linear history
164+ git pull --rebase origin "${{ steps.create-branch.outputs.upgrade-branch }}"
152165
153- # Push changes
154- git push origin "${{ steps.create-branch.outputs.upgrade-branch }}"
166+ # Push changes
167+ git push origin "${{ steps.create-branch.outputs.upgrade-branch }}"
155168
156- echo "::debug::Successfully committed and pushed changes"
157- fi
169+ echo "::debug::Successfully committed and pushed changes"
158170 - name : Create pull request
171+ if : steps.upgrade.outputs.has-changes == 'true'
159172 env :
160173 GITHUB_TOKEN : ${{ secrets.BOT_GITHUB_TOKEN }}
161174 run : |
@@ -176,13 +189,13 @@ jobs:
176189 PR_URL="$(gh pr create \
177190 --base "$BASE_BRANCH" \
178191 --head "$UPGRADE_BRANCH" \
179- --title "chore(aws-api-mcp-server): upgrade AWS CLI version" \
192+ --title "chore(aws-api-mcp-server): upgrade AWS CLI to v${{ steps.upgrade.outputs.latest- version }} " \
180193 --body "# AWS CLI Version Upgrade
181194
182195 This PR upgrades the AWS CLI version in the aws-api-mcp-server package.
183196
184197 ## Changes
185- * Updated AWS CLI dependencies to latest version
198+ * Updated AWS CLI from **v${{ steps.upgrade.outputs.current-version }}** to **v${{ steps.upgrade.outputs.latest- version }}**
186199
187200 ## Checklist
188201 - [ ] Dependencies have been upgraded
0 commit comments