fix: Fix CI/CD and implement dynamic versioning #3
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: Release Pipeline | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on version tags | |
| jobs: | |
| # Deploy to PyPI | |
| pypi: | |
| name: Deploy to PyPI | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| # Ensure git tags are available for versioning | |
| git fetch --prune --unshallow --tags || true | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Uses OIDC Trusted Publisher, no password needed! | |
| # Deploy to Docker Hub and GitHub Container Registry | |
| docker: | |
| name: Deploy Docker Images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| 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: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: docker.io | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| docker.io/ivolnistov/youtrack-rocket-mcp | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build release packages | |
| build-packages: | |
| name: Build Release Packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| # Ensure git tags are available for versioning | |
| git fetch --prune --unshallow --tags || true | |
| - name: Build packages | |
| run: python -m build | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/*.whl | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| # Create GitHub Release | |
| release: | |
| name: Create GitHub Release | |
| needs: [pypi, docker, build-packages] # Wait for all deployments and builds | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/ | |
| - name: Download sdist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/ | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Release v${{ steps.version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| body: | | |
| ## 🚀 Release v${{ steps.version.outputs.VERSION }} | |
| ### Installation Options: | |
| #### Direct Download | |
| Download the packages attached to this release. | |
| #### PyPI | |
| ```bash | |
| # Using uvx (no installation required) | |
| uvx youtrack-rocket-mcp | |
| # Or install with uv tool | |
| uv tool install youtrack-rocket-mcp | |
| # Or with pip | |
| pip install youtrack-rocket-mcp | |
| ``` | |
| #### Docker Hub | |
| ```bash | |
| docker pull ivolnistov/youtrack-rocket-mcp:${{ steps.version.outputs.VERSION }} | |
| docker pull ivolnistov/youtrack-rocket-mcp:latest | |
| ``` | |
| #### GitHub Container Registry | |
| ```bash | |
| docker pull ghcr.io/i-volnistov/youtrack-rocket-mcp:${{ steps.version.outputs.VERSION }} | |
| docker pull ghcr.io/i-volnistov/youtrack-rocket-mcp:latest | |
| ``` | |
| ### What's Changed | |
| See the full changelog below. |