fixing mcp action #3
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: "MCPs Pipeline" | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| permissions: | |
| actions: read # for detecting the Github Actions environment. | |
| id-token: write # for creating OIDC tokens for signing. | |
| packages: write # for uploading attestations. | |
| contents: read | |
| security-events: write # Required for uploading code scanning. | |
| attestations: write | |
| pages: write | |
| env: | |
| DOCKER_REGISTRY: 'docker.io' | |
| DOCKER_ORG: 'krishnamanchikalapudi' | |
| DEFAULT_WORKSPACE: "${{github.workspace}}/LLM/MCP" # | |
| jobs: | |
| helloWorldDockerPackage: | |
| name: "Docker package" | |
| runs-on: ubuntu-latest # https://github.com/actions/runner-images | |
| outputs: | |
| image_todays_tag: ${{ steps.set_var.outputs.TODAYS_DATE }} | |
| strategy: | |
| matrix: | |
| python: [ '3.12' ] | |
| env: | |
| ARTIFACT_NAME: "mcp-hello-world" | |
| BUILD_ID: "ga-${{github.run_number}}" | |
| DOCKER_BUILDX_PLATFORMS: 'linux/amd64,linux/arm64' | |
| DOCKER_METADATA_JSON: 'build-metadata.json' | |
| defaults: | |
| run: | |
| working-directory: "${{env.DEFAULT_WORKSPACE}}/1-hello-world" | |
| steps: | |
| - name: "Clone VCS" | |
| uses: actions/checkout@v5 # ref: https://github.com/actions/checkout | |
| - name: "Install RUFF" | |
| uses: astral-sh/ruff-action@v3 | |
| continue-on-error: true | |
| with: | |
| version: "latest" | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| src: "./src" | |
| - name: "Install pytest" | |
| uses: actions/setup-python@v6 | |
| continue-on-error: true | |
| with: | |
| python-version: "${{matrix.python}}" | |
| cache: "pip" | |
| cache-dependency-path: ./pyproject.toml | |
| - name: "Env vars and info" | |
| id: set_var | |
| run: | | |
| echo "TODAYS_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| echo "TODAYS_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: "Python: compile src" | |
| continue-on-error: true | |
| run: | | |
| python -m compileall -l ./src/ | |
| - name: "Python: compile tests " | |
| continue-on-error: true | |
| run: | | |
| python -m compileall -l ./tests/ | |
| - name: "RUFF: Lint all files" | |
| continue-on-error: true | |
| run: | | |
| ruff check --fix --statistics && ruff format --check --diff && ruff analyze graph | |
| - name: "Docker: authentication" | |
| id: config-docker | |
| uses: docker/login-action@v3 # ref https://github.com/marketplace/actions/docker-login | |
| with: | |
| registry: ${{env.DOCKER_REGISTRY}} | |
| username: ${{secrets.DOCKERHUB_USERNAME}} | |
| password: ${{secrets.DOCKERHUB_PASSWORD}} | |
| - name: "Docker: Set up QEMU emulation" | |
| uses: docker/setup-qemu-action@v3 | |
| - name: "Docker: Set up Buildx" | |
| uses: docker/setup-buildx-action@v3 # ref: https://github.com/marketplace/actions/docker-setup-buildx | |
| with: | |
| use: true | |
| platforms: ${{env.DOCKER_BUILDX_PLATFORMS}} | |
| # install: true | |
| - name: "Optional: list files" | |
| run: | | |
| tree . | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:latest | |
| - name: "Docker build and push" | |
| uses: docker/build-push-action@v6 # https://github.com//docker/build-push-action | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| with: | |
| push: true | |
| context: . | |
| file: ./Dockerfile | |
| platforms: ${{env.DOCKER_BUILDX_PLATFORMS}} | |
| sbom: true | |
| tags: | | |
| ${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:${{env.TODAYS_DATE}} | |
| ${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:py-${{matrix.python}} | |
| ${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:${{env.BUILD_ID}} | |
| ${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:latest | |
| ${{ env.DOCKER_REGISTRY }}/${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:jdk-${{matrix.python}} | |
| ${{ env.DOCKER_REGISTRY }}/${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:${{env.TODAYS_DATE}} | |
| ${{ env.DOCKER_REGISTRY }}/${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:${{env.BUILD_ID}} | |
| ${{ env.DOCKER_REGISTRY }}/${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}:latest | |
| - name: "Docker: image list" | |
| run: | | |
| docker image ls | |
| - name: "Evidence: GitHub Attest for docker image" | |
| continue-on-error: true | |
| uses: actions/attest-build-provenance@v3 # https://github.com/marketplace/actions/attest-build-provenance | |
| with: | |
| subject-name: '${{env.DOCKER_REGISTRY}}/${{env.DOCKER_ORG}}/${{env.ARTIFACT_NAME}}' | |
| subject-digest: '${{ env.DOCKER_DIGEST }}' # sha256:hex_digest | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| push-to-registry: true | |
| show-summary: true | |
| - name: "Docker: Summary " | |
| run: | | |
| echo "# :ship: Docker: Summary :pushpin:" >> $GITHUB_STEP_SUMMARY | |
| echo " " >> $GITHUB_STEP_SUMMARY | |
| echo " " >> $GITHUB_STEP_SUMMARY | |
| echo " Build on: ${{env.TODAYS_DATE}} " >> $GITHUB_STEP_SUMMARY | |
| echo " - ubuntu-latest installed with: " >> $GITHUB_STEP_SUMMARY | |
| echo " - $(java --version) " >> $GITHUB_STEP_SUMMARY | |
| echo " - $(mvn -v) " >> $GITHUB_STEP_SUMMARY | |
| echo " - $(docker -v) " >> $GITHUB_STEP_SUMMARY | |
| echo " - $(python3 -V) " >> $GITHUB_STEP_SUMMARY | |
| echo " - $(pip3 -V) " >> $GITHUB_STEP_SUMMARY | |
| echo " - NPM version: $(npm -v) " >> $GITHUB_STEP_SUMMARY | |
| echo " - Node version: $(node -v) " >> $GITHUB_STEP_SUMMARY | |
| echo " - Docker buildx configured with platforms: [${{env.DOCKER_BUILDX_PLATFORMS}}](https://docs.docker.com/reference/cli/docker/buildx/create/#platform) " >> $GITHUB_STEP_SUMMARY | |
| echo " " >> $GITHUB_STEP_SUMMARY | |
| echo " - Variables info" >> $GITHUB_STEP_SUMMARY | |
| echo " - Build ID: ${{env.BUILD_ID}} " >> $GITHUB_STEP_SUMMARY | |
| echo " - Artifact Name: ${{env.ARTIFACT_NAME}} " >> $GITHUB_STEP_SUMMARY | |
| echo " - Artifact Version: ${{env.TODAYS_DATE}} " >> $GITHUB_STEP_SUMMARY | |
| echo " - Docker Path: [https://hub.docker.com/orgs/${{env.DOCKER_ORG}}/repositories](https://hub.docker.com/orgs/${{env.DOCKER_ORG}}/repositories) " >> $GITHUB_STEP_SUMMARY | |
| echo " - GitHub Attest: ${{ env.DOCKER_DIGEST }} " >> $GITHUB_STEP_SUMMARY | |
| echo " " >> $GITHUB_STEP_SUMMARY | |