name: release.yml on: workflow_dispatch: jobs: release-github: name: Create GitHub Release from ${{ github.ref_name }} outputs: tag: ${{ steps.create_tag.outputs.tag }} version: ${{ steps.create_tag.outputs.version }} permissions: contents: write runs-on: ubuntu-latest steps: - name: Check out ${{ github.ref_name }} uses: actions/checkout@v6 with: ref: ${{ github.ref_name }} fetch-depth: 0 # Fetch all history for comparison - name: Fetch main branch for comparison if: ${{ github.ref_name == 'dev' }} run: git fetch origin main:main - name: Fetch dev branch for comparison if: ${{ github.ref_name == 'main' }} run: git fetch origin dev:dev - name: Install uv uses: astral-sh/setup-uv@v7 - name: Install Python run: uv python install - name: Install dependencies run: uv sync --locked - name: Create and push git tag id: create_tag run: | VERSION="$(uv version --short)" TAG="v${VERSION}" echo "Tag to create: ${TAG}" git config user.name "Cognee Team" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT" git tag "${TAG}" git push origin "${TAG}" - name: Generate AI-powered release notes id: generate_notes env: LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} LLM_ARGS: ${{ secrets.LLM_ARGS }} LLM_MODEL: ${{ secrets.LLM_MODEL != '' && secrets.LLM_MODEL || 'openai/gpt-4o-mini' }} run: | # Set PYTHONPATH to include project root export PYTHONPATH="${GITHUB_WORKSPACE}:${PYTHONPATH}" # Generate release notes # Compares current branch against the latest release tag automatically uv run python tools/generate_release_notes.py \ --version "${{ steps.create_tag.outputs.version }}" \ --github-output - name: Create GitHub Release with AI-generated notes uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.create_tag.outputs.tag }} name: ${{ steps.generate_notes.outputs.RELEASE_TITLE }} body: ${{ steps.generate_notes.outputs.RELEASE_NOTES }} prerelease: ${{ github.ref_name == 'dev' }} env: GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} release-pypi-package: needs: release-github name: Release PyPI Package from ${{ github.ref_name }} permissions: contents: read runs-on: ubuntu-latest steps: - name: Check out ${{ github.ref_name }} uses: actions/checkout@v6 with: ref: ${{ github.ref_name }} - name: Install uv uses: astral-sh/setup-uv@v7 - name: Install Python run: uv python install - name: Install dependencies run: uv sync --locked --all-extras - name: Build distributions run: uv build - name: Publish ${{ github.ref_name }} release to PyPI env: UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} run: uv publish release-docker-image: needs: release-github name: Release Docker Image from ${{ github.ref_name }} permissions: contents: read runs-on: ubuntu-latest steps: - name: Check out ${{ github.ref_name }} uses: actions/checkout@v6 with: ref: ${{ github.ref_name }} - 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.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Dev Docker Image if: ${{ github.ref_name == 'dev' }} uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: cognee/cognee:${{ needs.release-github.outputs.version }} labels: | version=${{ needs.release-github.outputs.version }} flavour=${{ github.ref_name }} cache-from: type=registry,ref=cognee/cognee:buildcache cache-to: type=registry,ref=cognee/cognee:buildcache,mode=max - name: Build and push Main Docker Image if: ${{ github.ref_name == 'main' }} uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: | cognee/cognee:${{ needs.release-github.outputs.version }} cognee/cognee:latest labels: | version=${{ needs.release-github.outputs.version }} flavour=${{ github.ref_name }} cache-from: type=registry,ref=cognee/cognee:buildcache cache-to: type=registry,ref=cognee/cognee:buildcache,mode=max - name: Build and push Dev MCP Docker Image if: ${{ github.ref_name == 'dev' }} uses: docker/build-push-action@v6 with: context: . file: cognee-mcp/Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: cognee/cognee-mcp:${{ needs.release-github.outputs.version }} labels: | version=${{ needs.release-github.outputs.version }} flavour=${{ github.ref_name }} cache-from: type=registry,ref=cognee/cognee-mcp:buildcache cache-to: type=registry,ref=cognee/cognee-mcp:buildcache,mode=max - name: Build and push Main MCP Docker Image if: ${{ github.ref_name == 'main' }} uses: docker/build-push-action@v6 with: context: . file: cognee-mcp/Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: | cognee/cognee-mcp:${{ needs.release-github.outputs.version }} cognee/cognee-mcp:latest labels: | version=${{ needs.release-github.outputs.version }} flavour=${{ github.ref_name }} cache-from: type=registry,ref=cognee/cognee-mcp:buildcache cache-to: type=registry,ref=cognee/cognee-mcp:buildcache,mode=max trigger-docs-test-suite: needs: release-pypi-package if: ${{ github.ref_name == 'main' }} runs-on: ubuntu-22.04 steps: - name: Trigger docs tests run: | curl -L -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.REPO_DISPATCH_PAT_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/topoteretes/cognee-docs/dispatches \ -d '{"event_type":"new-main-release","client_payload":{"caller_repo":"'"${GITHUB_REPOSITORY}"'"}}' trigger-community-test-suite: needs: release-pypi-package if: ${{ github.ref_name == 'main' }} runs-on: ubuntu-22.04 steps: - name: Trigger community tests run: | curl -L -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.REPO_DISPATCH_PAT_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/topoteretes/cognee-community/dispatches \ -d '{"event_type":"new-main-release","client_payload":{"caller_repo":"'"${GITHUB_REPOSITORY}"'"}}' notify-discord: needs: release-github name: Send Release to Discord if: ${{ github.ref_name == 'main' }} runs-on: ubuntu-22.04 steps: - name: Send Discord notification env: WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} TAG: ${{ needs.release-github.outputs.tag }} VERSION: ${{ needs.release-github.outputs.version }} run: | RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/${TAG}" PAYLOAD=$(jq -n \ --arg content "||@everyone|| **${TAG}** has been released!" \ --arg title "Release ${TAG}" \ --arg url "$RELEASE_URL" \ --arg description "Version ${VERSION} released from \`${{ github.ref_name }}\`. [View release notes](${RELEASE_URL})" \ --argjson color 2105893 \ '{ content: $content, embeds: [{ title: $title, url: $url, description: $description, color: $color, footer: { text: "Changelog" }, timestamp: (now | todate) }] }') curl -s -H "Content-Type: application/json" -d "$PAYLOAD" "$WEBHOOK_URL"