Skip to content

Commit 6a7400e

Browse files
authored
Merge pull request #47 from tishun/topic/tishu/pipy-release
Manual trigger for the release flow
2 parents 6abf568 + 0a2d508 commit 6a7400e

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ name: Release to PyPI
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to release (e.g., 0.3.0)'
10+
required: true
11+
type: string
12+
environment:
13+
description: 'Target environment'
14+
required: true
15+
default: 'pypi'
16+
type: choice
17+
options:
18+
- pypi
19+
- testpypi
20+
dry_run:
21+
description: 'Dry run (build only, do not publish)'
22+
required: false
23+
default: false
24+
type: boolean
625

726
permissions:
827
contents: read
@@ -116,9 +135,9 @@ jobs:
116135
build-and-publish:
117136
runs-on: ubuntu-latest
118137
needs: [validate-release, security-scan, test]
119-
environment:
120-
name: pypi
121-
url: https://pypi.org/p/redis-mcp-server
138+
environment:
139+
name: ${{ github.event.inputs.environment || 'pypi' }}
140+
url: ${{ github.event.inputs.environment == 'testpypi' && 'https://test.pypi.org/p/redis-mcp-server' || 'https://pypi.org/p/redis-mcp-server' }}
122141
permissions:
123142
id-token: write # IMPORTANT: mandatory for trusted publishing
124143
contents: read
@@ -158,11 +177,22 @@ jobs:
158177
subject-path: 'dist/*'
159178

160179
- name: ⚙️ Publish to PyPI
180+
if: ${{ !inputs.dry_run }}
161181
uses: pypa/gh-action-pypi-publish@release/v1
162182
with:
183+
repository-url: ${{ github.event.inputs.environment == 'testpypi' && 'https://test.pypi.org/legacy/' || '' }}
163184
print-hash: true
164185
attestations: true
165186

187+
- name: ⚙️ Dry run - Package ready for publishing
188+
if: ${{ inputs.dry_run }}
189+
run: |
190+
echo "🔍 DRY RUN MODE - Package built successfully but not published"
191+
echo "📦 Built packages:"
192+
ls -la dist/
193+
echo ""
194+
echo "✅ Package is ready for publishing to ${{ github.event.inputs.environment || 'pypi' }}"
195+
166196
- name: ⚙️ Upload build artifacts
167197
uses: actions/upload-artifact@v4
168198
with:
@@ -177,6 +207,20 @@ jobs:
177207
steps:
178208
- name: ⚙️ Success notification
179209
run: |
180-
echo "🎉 Successfully released Redis MCP Server v${{ needs.validate-release.outputs.version }} to PyPI!"
181-
echo "📦 Package: https://pypi.org/project/redis-mcp-server/${{ needs.validate-release.outputs.version }}/"
182-
echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
210+
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
211+
echo "🔍 DRY RUN COMPLETED - Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }} ready for release!"
212+
echo "📦 Package built successfully but not published"
213+
echo "🎯 Target environment: ${{ github.event.inputs.environment || 'pypi' }}"
214+
else
215+
echo "🎉 Successfully released Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }} to ${{ github.event.inputs.environment || 'PyPI' }}!"
216+
if [[ "${{ github.event.inputs.environment }}" == "testpypi" ]]; then
217+
echo "📦 Package: https://test.pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
218+
else
219+
echo "📦 Package: https://pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
220+
fi
221+
if [[ "${{ github.event_name }}" == "release" ]]; then
222+
echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
223+
else
224+
echo "🚀 Manual release triggered by: ${{ github.actor }}"
225+
fi
226+
fi

0 commit comments

Comments
 (0)