File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ CURRENT_BRANCH=$1
4
+ CURRENT_COMMIT=$2
5
+
6
+ published-commit (){
7
+ curl -s http://docs.mongodb.org/$CURRENT_BRANCH /release.txt
8
+ }
9
+
10
+ CURRENT_PUBLISHED_BRANCH=` published-commit`
11
+
12
+ if [ $CURRENT_COMMIT = $CURRENT_PUBLISHED_BRANCH ]; then
13
+ echo " [build]: Error. The published version of '$CURRENT_BRANCH ' matches the last commit of this repo."
14
+ echo " Commit local changes before publishing."
15
+ exit 1
16
+ else
17
+ echo [buid]: Last commit on \' $CURRENT_BRANCH \' is different from the published version. Update, if needed, and deploy at will.
18
+ fi
Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ public-branch-output = $(public-output)/$(current-branch)
11
11
12
12
# change this to reflect the branch that "manual/" will point to
13
13
manual-branch = master
14
- # intuit the current branch
14
+ # intuit the current branch and commit
15
15
current-branch := $(shell git symbolic-ref HEAD 2>/dev/null | cut -d "/" -f "3" )
16
+ last-commit := $(shell git rev-parse --verify HEAD)
16
17
17
18
ifeq ($(current-branch ) ,$(manual-branch ) )
18
19
current-if-not-manual = $(manual-branch )
@@ -64,15 +65,22 @@ help:
64
65
# Meta targets that control the build and publication process.
65
66
#
66
67
67
- push :publish
68
+ .PHONY : push publish-if-up-to-date
69
+
70
+ push :publish-if-up-to-date
68
71
@echo [build]: copying the new $(current-branch ) build to the web servers.
69
72
$(MAKE ) MODE=' push' push-dc1 push-dc2
70
73
@echo [build]: deployed a new build of the $(current-branch ) branch of the Manual.
74
+
71
75
push-all :publish
72
76
@echo [build]: copying the full docs site to the web servers.
73
77
$(MAKE ) MODE=' push' push-all-dc1 push-all-dc2
74
78
@echo [build]: deployed a new build of the full Manual.
75
79
80
+ publish-if-up-to-date :
81
+ @bin/published-build-check $(current-branch ) $(last-commit )
82
+ $(MAKE ) publish
83
+
76
84
publish :initial-dependencies
77
85
$(MAKE ) sphinx-components static-components
78
86
@echo [build]: $(manual-branch ) branch is succeessfully deployed to ' $(public-output)' .
You can’t perform that action at this time.
0 commit comments