mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-10 17:26:38 +08:00
ci: canary
This commit is contained in:
@@ -109,37 +109,31 @@ dev:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Merge the current branch into canary and push, triggering Build Image (:canary).
|
|
||||||
|
# Merge local feat into canary, push canary, then restore the previous branch.
|
||||||
|
# Does not leave the working tree on canary when started from another branch.
|
||||||
canary:
|
canary:
|
||||||
@set -e; \
|
@set -e; \
|
||||||
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
|
if ! git rev-parse --git-dir >/dev/null 2>&1; then \
|
||||||
echo "error: not a git repository" >&2; \
|
echo "Error: not a git repository"; exit 1; \
|
||||||
exit 1; \
|
|
||||||
fi; \
|
fi; \
|
||||||
if [ -n "$$(git status --porcelain)" ]; then \
|
if [ -n "$$(git status --porcelain)" ]; then \
|
||||||
echo "error: working tree is dirty; commit or stash changes first" >&2; \
|
echo "Error: working tree is dirty; commit or stash first"; exit 1; \
|
||||||
exit 1; \
|
|
||||||
fi; \
|
fi; \
|
||||||
CURRENT_BRANCH=$$(git rev-parse --abbrev-ref HEAD); \
|
orig=$$(git rev-parse --abbrev-ref HEAD); \
|
||||||
if [ "$$CURRENT_BRANCH" = "HEAD" ]; then \
|
if [ "$$orig" = "HEAD" ]; then \
|
||||||
echo "error: detached HEAD; checkout a branch first" >&2; \
|
echo "Error: detached HEAD; checkout a branch first"; exit 1; \
|
||||||
exit 1; \
|
|
||||||
fi; \
|
fi; \
|
||||||
echo "==> Publishing $$CURRENT_BRANCH to canary..."; \
|
cleanup() { \
|
||||||
git fetch origin; \
|
cur=$$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true); \
|
||||||
if git show-ref --verify --quiet refs/remotes/origin/canary; then \
|
if [ "$$cur" != "$$orig" ]; then \
|
||||||
git checkout -B canary origin/canary; \
|
echo "Restoring branch $$orig..."; \
|
||||||
else \
|
git checkout -q "$$orig"; \
|
||||||
git checkout -B canary; \
|
|
||||||
fi; \
|
|
||||||
if [ "$$CURRENT_BRANCH" != "canary" ]; then \
|
|
||||||
if ! git merge --no-edit "$$CURRENT_BRANCH"; then \
|
|
||||||
echo "error: merge failed; resolve conflicts on canary, then: git push -u origin canary" >&2; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
}; \
|
||||||
|
trap cleanup EXIT; \
|
||||||
|
echo "Merging feat -> canary (started from $$orig)..."; \
|
||||||
|
git checkout canary; \
|
||||||
|
git merge --no-edit feat; \
|
||||||
git push -u origin canary; \
|
git push -u origin canary; \
|
||||||
if [ "$$CURRENT_BRANCH" != "canary" ]; then \
|
echo "Done: feat merged into canary and pushed."
|
||||||
git checkout "$$CURRENT_BRANCH"; \
|
|
||||||
fi; \
|
|
||||||
echo "==> canary updated and pushed (image tag: canary)"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user