Skip to content

Commit 713b9c3

Browse files
committed
fix github action
1 parent f362fa6 commit 713b9c3

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

.github/scripts/on_tag_pushed.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,43 @@ echo "🏷️ Tag: $VERSION"
1717

1818
COMPONENT_PATH="subvortex/$COMPONENT"
1919
if [[ -f "$COMPONENT_PATH/pyproject.toml" ]]; then
20-
echo "✅ Found pyproject.toml"
21-
COMPONENT_VERSION=$(grep -E '^version\s*=' "$COMPONENT_PATH/pyproject.toml" | head -1 | sed -E 's/version\s*=\s*"([^"]+)"/\1/')
22-
elif [[ -f "$COMPONENT_PATH/version.py" ]]; then
23-
echo "✅ Found version.py"
24-
COMPONENT_VERSION=$(python -c "import ast; f=open('$COMPONENT_PATH/version.py'); print([n.value.s for n in ast.walk(ast.parse(f.read())) if isinstance(n, ast.Assign) and n.targets[0].id == '__version__'][0])")
20+
echo "✅ Found pyproject.toml"
21+
COMPONENT_VERSION=$(grep -E '^version\s*=' "$COMPONENT_PATH/pyproject.toml" | head -1 | sed -E 's/version\s*=\s*"([^"]+)"/\1/')
22+
elif [[ -f "$COMPONENT_PATH/version.py" ]]; then
23+
echo "✅ Found version.py"
24+
COMPONENT_VERSION=$(python -c "import ast; f=open('$COMPONENT_PATH/version.py'); print([n.value.s for n in ast.walk(ast.parse(f.read())) if isinstance(n, ast.Assign) and n.targets[0].id == '__version__'][0])")
2525
else
26-
echo "❌ No version file found for component: $COMPONENT"
27-
exit 1
26+
echo "❌ No version file found for component: $COMPONENT"
27+
exit 1
2828
fi
2929

3030
echo "🧾 Resolved Versions:"
3131
echo "VERSION=$VERSION"
3232
echo "COMPONENT_VERSION=$COMPONENT_VERSION"
3333

3434
# -- Check if local image already matches
35-
LABEL_KEY="$COMPONENT.$SERVICE.version"
35+
LABEL_KEY="$COMPONENT.version"
3636

3737
# Try to read the label from local docker images
3838
EXISTING_COMPONENT_VERSION=$(docker image inspect "$IMAGE:$VERSION" --format "{{ index .Config.Labels \"$LABEL_KEY\" }}" 2>/dev/null || echo "")
3939

4040
if [[ "$EXISTING_COMPONENT_VERSION" == "$COMPONENT_VERSION" ]]; then
41-
echo "✅ Image already built for $COMPONENT/$SERVICE with version $COMPONENT_VERSION. Skipping build."
42-
exit 0
41+
echo "✅ Image already built for $COMPONENT with version $COMPONENT_VERSION. Skipping build."
42+
exit 0
4343
fi
4444

4545
echo "🚀 Building and pushing image: $IMAGE:$VERSION"
4646

4747
docker buildx build \
48-
--squash \
49-
--platform linux/amd64 \
50-
--build-context wheelbuilder=docker-image://$WHEEL_IMAGE \
51-
--build-arg VERSION="$VERSION" \
52-
--build-arg COMPONENT_VERSION="$COMPONENT_VERSION" \
53-
--cache-from=type=gha,scope=wheels_${COMPONENT}_amd64 \
54-
--cache-to=type=gha,mode=max,scope=wheels_${COMPONENT}_amd64 \
55-
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
56-
--tag "$IMAGE:$VERSION" \
57-
--file "$DOCKERFILE" \
58-
--push \
59-
.
48+
--squash \
49+
--platform linux/amd64 \
50+
--build-context wheelbuilder=docker-image://$WHEEL_IMAGE \
51+
--build-arg VERSION="$VERSION" \
52+
--build-arg COMPONENT_VERSION="$COMPONENT_VERSION" \
53+
--cache-from=type=gha,scope=wheels_${COMPONENT}_amd64 \
54+
--cache-to=type=gha,mode=max,scope=wheels_${COMPONENT}_amd64 \
55+
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
56+
--tag "$IMAGE:$VERSION" \
57+
--file "$DOCKERFILE" \
58+
--push \
59+
.

0 commit comments

Comments
 (0)