CI: Update release workflow

This commit is contained in:
Pavel Zorin 2025-12-15 20:18:51 +01:00
parent 405c925b70
commit 4936551a90

View file

@ -10,10 +10,6 @@ on:
- dev - dev
- main - main
description: Dev or Main release description: Dev or Main release
test_mode:
required: true
type: boolean
description: Aka Dry Run. If true, it won't affect public indices or repositories
jobs: jobs:
release-github: release-github:
@ -35,8 +31,6 @@ jobs:
- name: Create and push git tag - name: Create and push git tag
id: create_tag id: create_tag
env:
TEST_MODE: ${{ inputs.test_mode }}
run: | run: |
VERSION="$(uv version --short)" VERSION="$(uv version --short)"
TAG="v${VERSION}" TAG="v${VERSION}"
@ -48,13 +42,10 @@ jobs:
echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
if [ "$TEST_MODE" = "false" ]; then git tag "${TAG}"
git tag "${TAG}" git push origin "${TAG}"
git push origin "${TAG}"
else
echo "Test mode is enabled. Skipping tag creation and push."
fi
- name: Create GitHub Release - name: Create GitHub Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
@ -89,14 +80,7 @@ jobs:
- name: Build distributions - name: Build distributions
run: uv build run: uv build
- name: Publish ${{ inputs.flavour }} release to TestPyPI
if: ${{ inputs.test_mode }}
env:
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
run: uv publish --publish-url https://test.pypi.org/legacy/
- name: Publish ${{ inputs.flavour }} release to PyPI - name: Publish ${{ inputs.flavour }} release to PyPI
if: ${{ !inputs.test_mode }}
env: env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish run: uv publish
@ -121,15 +105,15 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Dev Docker Image - name: Build and push Dev Docker Image
if: ${{ inputs.flavour == 'dev' }} if: ${{ inputs.flavour == 'dev' }}
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ !inputs.test_mode }} push: true
tags: cognee/cognee:${{ needs.release-github.outputs.version }} tags: cognee/cognee:${{ needs.release-github.outputs.version }}
labels: | labels: |
version=${{ needs.release-github.outputs.version }} version=${{ needs.release-github.outputs.version }}
@ -143,7 +127,6 @@ jobs:
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ !inputs.test_mode }}
tags: | tags: |
cognee/cognee:${{ needs.release-github.outputs.version }} cognee/cognee:${{ needs.release-github.outputs.version }}
cognee/cognee:latest cognee/cognee:latest