:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ci): tag agent releases at the latest master head (#106016)
Alessandro Pogliaghi2d7fe633fcb1
diff --git a/.github/workflows/desktop-agent-tag.yml b/.github/workflows/desktop-agent-tag.ymlindex 739fd4b9616f..baef5ef46bc5 100644--- a/.github/workflows/desktop-agent-tag.yml+++ b/.github/workflows/desktop-agent-tag.yml@@ -54,29 +54,47 @@ jobs:MAJOR=$(echo "$VERSION_PART" | cut -d. -f1)MINOR=$(echo "$VERSION_PART" | cut -d. -f2)- # Count commits touching the agent or harness package since the base tag. In the- # monorepo an unscoped count would include every PostHog commit and- # inflate patch numbers meaninglessly.- PATCH=$(git rev-list "$LATEST_TAG"..HEAD --count -- \- products/desktop/packages/agent \- products/desktop/packages/harness)+ # Annotated tags need a local tagger identity even when the push uses an app token.+ git config user.email "github-actions[bot]@users.noreply.github.com"+ git config user.name "github-actions[bot]"- if [ "$PATCH" -eq 0 ]; then- echo "No agent or harness commits since $LATEST_TAG. Nothing to release."- exit 0- fi+ for attempt in 1 2 3; do+ git fetch --quiet --no-tags origin refs/heads/master+ TARGET=$(git rev-parse 'FETCH_HEAD^{commit}')- NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"- TAG="agent-v$NEW_VERSION"+ # Count commits touching the agent or harness package since the base tag. In the+ # monorepo an unscoped count would include every PostHog commit and+ # inflate patch numbers meaninglessly.+ PATCH=$(git rev-list "$LATEST_TAG".."$TARGET" --count -- \+ products/desktop/packages/agent \+ products/desktop/packages/harness)- if git rev-parse "$TAG" >/dev/null 2>&1; then- echo "Tag $TAG already exists. Nothing new to release."- exit 0- fi+ if [ "$PATCH" -eq 0 ]; then+ echo "No agent or harness commits since $LATEST_TAG. Nothing to release."+ exit 0+ fi- echo "Creating tag: $TAG (from base tag $LATEST_TAG + $PATCH commits)"+ NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"+ TAG="agent-v$NEW_VERSION"- git config user.email "github-actions[bot]@users.noreply.github.com"- git config user.name "github-actions[bot]"- git tag -a "$TAG" -m "Agent release $TAG"- git push "https://x-access-token:${GH_TOKEN}@github.com/$REPOSITORY" "$TAG"+ if git rev-parse "$TAG" >/dev/null 2>&1; then+ echo "Tag $TAG already exists. Nothing new to release."+ exit 0+ fi++ echo "Creating tag: $TAG at $TARGET (from base tag $LATEST_TAG + $PATCH commits)"+ git tag -a "$TAG" -m "Agent release $TAG" "$TARGET"+ if git push "https://x-access-token:${GH_TOKEN}@github.com/$REPOSITORY" "$TAG"; then+ exit 0+ fi+ # The remote can accept a tag before the connection fails.+ if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null; then+ echo "Tag $TAG already exists on origin. Nothing new to release."+ exit 0+ fi+ git tag -d "$TAG"+ if [ "$attempt" -lt 3 ]; then+ sleep $((attempt * 10))+ fi+ done+ exit 1