Skip to content

Commit 7b9594b

Browse files
liyakaclaude
andcommitted
ci: generate version file before builds, build on main only, tidy versioning
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8c1be4a commit 7b9594b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: CI
22
run-name: "CI ${{ github.ref_name }} by @${{ github.actor }}"
33

4-
# Public-repo, GitHub-hosted runners. code-panels-style flow, inlined (gha-tools
5-
# is private and unusable from a public repo).
4+
# CI on GitHub-hosted runners: validate, build the multi-arch image, tag releases.
65
#
76
# Version = <version.txt MAJOR.MINOR>.<patch>, patch = (max existing x.y tag) + 1,
87
# so it starts at 0 and resets per minor:
9-
# main -> ghcr.io/comet-ml/opik-mcp:0.2.0 (+ :main, + git tag 0.2.0)
10-
# branch -> ghcr.io/comet-ml/opik-mcp:0.2.<next>-<branch> (no git tag)
11-
# PR -> build only (no push, no secrets — fork-safe)
8+
# push to main -> ghcr.io/comet-ml/opik-mcp:0.2.0 (+ :main, + git tag 0.2.0)
9+
# PR -> build only (no push, no secrets — fork-safe); version
10+
# carries a -<branch> suffix for the image tag if built
1211
#
1312
# Bump version.txt (e.g. 0.2 -> 0.3) to start a new minor line; patch resets to 0.
1413
# Release is manual (release.yaml): pick a git tag, promote its image, publish.
@@ -20,7 +19,7 @@ on:
2019
- main
2120
push:
2221
branches:
23-
- '**'
22+
- main
2423

2524
permissions:
2625
contents: read
@@ -87,8 +86,10 @@ jobs:
8786
done
8887
else
8988
PATCH=$(( $(find_max_patch) + 1 ))
89+
# Normalize: lowercase, non-alnum -> '-', cap at 20 chars,
90+
# strip trailing dashes.
9091
SLUG=$(echo "$REF_NAME" | tr '[:upper:]' '[:lower:]' | sed -E 's#[^a-z0-9]+#-#g; s#^-+##; s#-+$##')
91-
SLUG=${SLUG:0:30}; SLUG=${SLUG%-}
92+
SLUG=${SLUG:0:20}; SLUG=${SLUG%-}
9293
VERSION="$BASE.$PATCH-$SLUG"
9394
fi
9495
# The image tag may carry a -branch suffix (fine for Docker tags), but
@@ -100,6 +101,7 @@ jobs:
100101
fi
101102
echo "version=$VERSION" | tee -a "$GITHUB_OUTPUT"
102103
echo "pyver=$PYVER" | tee -a "$GITHUB_OUTPUT"
104+
echo "### Version: $VERSION" >> "$GITHUB_STEP_SUMMARY"
103105
104106
python-checks:
105107
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)