jasketch-v0.3.93 #53
Workflow file for this run
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: Build and Deploy JaSketch | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| publish-mcp: | |
| if: startsWith(github.ref, 'refs/tags/jasketch-') || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| published: ${{ steps.publish.outputs.published }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tools | |
| run: pip install build twine requests | |
| - name: Check if MCP version needs publishing | |
| id: check | |
| working-directory: mcp-server | |
| run: | | |
| LOCAL=$(python -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d['project']['version'])") | |
| PUBLISHED=$(python -c " | |
| import urllib.request, json | |
| try: | |
| r = urllib.request.urlopen('https://pypi.org/pypi/jasketch-mcp-server/json') | |
| print(json.loads(r.read())['info']['version']) | |
| except: | |
| print('none') | |
| ") | |
| echo "Local: $LOCAL | Published: $PUBLISHED" | |
| if [ "$LOCAL" != "$PUBLISHED" ]; then | |
| echo "needs_publish=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "needs_publish=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build package | |
| if: steps.check.outputs.needs_publish == 'true' | |
| working-directory: mcp-server | |
| run: python -m build | |
| - name: Publish to PyPI | |
| id: publish | |
| if: steps.check.outputs.needs_publish == 'true' | |
| working-directory: mcp-server | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| twine upload dist/* | |
| echo "published=true" >> $GITHUB_OUTPUT | |
| deploy-jasketch: | |
| needs: [publish-mcp] | |
| if: startsWith(github.ref, 'refs/tags/jasketch-') || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.tag.outputs.tag }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4.2.0 | |
| with: | |
| aws-region: us-east-2 | |
| role-to-assume: arn:aws:iam::776241927220:role/GitHubActionsSharedECRRole | |
| role-session-name: GitHubActions | |
| audience: sts.amazonaws.com | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Get tag name | |
| id: tag | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAG="manual-$(date +%Y%m%d-%H%M%S)" | |
| elif [[ "${{ github.event_name }}" == "release" ]]; then | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| if [[ $TAG_NAME =~ ^jasketch-(.+)$ ]]; then | |
| TAG="${BASH_REMATCH[1]}" | |
| elif [[ $TAG_NAME =~ ^v(.+)$ ]]; then | |
| TAG="$TAG_NAME" | |
| else | |
| TAG="$TAG_NAME" | |
| fi | |
| else | |
| TAG="latest" | |
| fi | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| env: | |
| ECR_REGISTRY: 776241927220.dkr.ecr.us-east-2.amazonaws.com | |
| ECR_REPOSITORY: jasketch | |
| IMAGE_TAG: ${{ steps.tag.outputs.tag }} | |
| run: | | |
| docker buildx build \ | |
| --platform linux/amd64 \ | |
| -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ | |
| -t $ECR_REGISTRY/$ECR_REPOSITORY:latest \ | |
| --push \ | |
| . | |
| summary: | |
| needs: [publish-mcp, deploy-jasketch] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## JaSketch Release Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **MCP PyPI Published**: ${{ needs.publish-mcp.outputs.published || 'skipped (already up to date)' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Image Tag**: ${{ needs.deploy-jasketch.outputs.tag }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **ECR Repository**: 776241927220.dkr.ecr.us-east-2.amazonaws.com/jasketch" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Deploy Status**: ${{ needs.deploy-jasketch.result }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Application URL**: https://jasketch.jaseci.org" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Note**: Deployment will be handled automatically by Flux in the infrastructure repository." >> $GITHUB_STEP_SUMMARY |