32 lines
918 B
Bash
32 lines
918 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo "🚀 Starting wp-kaniko-sync"
|
|
|
|
TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
|
|
echo "🧩 Using tag: $TAG"
|
|
|
|
/kaniko/executor \
|
|
--dockerfile="${PLUGIN_DOCKERFILE}" \
|
|
--context="${PLUGIN_CONTEXT}" \
|
|
--destination="${PLUGIN_REGISTRY}/${PLUGIN_REPO}:${TAG}" \
|
|
--destination="${PLUGIN_REGISTRY}/${PLUGIN_REPO}:latest" \
|
|
--insecure-push=true \
|
|
--skip-tls-verify=true \
|
|
--cleanup
|
|
|
|
echo "✅ Image pushed successfully"
|
|
|
|
if [[ -n "$PLUGIN_GIT_REPO" ]]; then
|
|
git config --global user.name "woodpecker-bot"
|
|
git config --global user.email "ci@dvirlabs.com"
|
|
git clone "https://${PLUGIN_GIT_USERNAME}:${PLUGIN_GIT_TOKEN}@${PLUGIN_GIT_REPO}"
|
|
cd $(basename "$PLUGIN_GIT_REPO" .git)
|
|
|
|
yq -i ".$PLUGIN_VALUES_PATH = \"$TAG\"" "$PLUGIN_VALUES_FILE"
|
|
|
|
git add "$PLUGIN_VALUES_FILE"
|
|
git commit -m "${PLUGIN_NAME}: update tag to $TAG" || echo "⚠️ No changes"
|
|
git push origin HEAD
|
|
fi
|