release.yml•3.72 kB
name: Release
on:
push:
tags:
- 'v*.*.*' # Trigger condition: v0.15.2, v1.0.0, etc.
permissions:
contents: write
id-token: write # For OIDC trusted publishing
jobs:
# Job 1: Build Python Package
build-python:
name: Build Python Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-package
path: dist/*
# Job 2: Publish to PyPI (using OIDC trusted publishing)
publish-pypi:
name: Publish to PyPI
needs: build-python
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/jupyter-mcp-server
permissions:
id-token: write # Required for OIDC
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-package
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# No password needed, using OIDC trusted publishing
skip-existing: true
# Job 3: Build and Publish Docker Image
build-docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # For GHCR
id-token: write # For Docker Hub OIDC (optional)
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
datalayer/jupyter-mcp-server:latest
datalayer/jupyter-mcp-server:${{ steps.version.outputs.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Job 4: Create GitHub Release
create-release:
name: Create GitHub Release
needs: [publish-pypi, build-docker]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for release creation
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.VERSION }}
body: |
## 🚀 Release ${{ steps.version.outputs.VERSION }}
### 🔗 Links
- [PyPI](https://pypi.org/project/jupyter-mcp-server/${{ steps.version.outputs.VERSION }}/)
- [Docker Hub](https://hub.docker.com/r/datalayer/jupyter-mcp-server)
draft: false
prerelease: false
generate_release_notes: true