Browse Source

Merge pull request #6681 from thinkyhead/bf_better_mfpub

Better mfpub
Scott Lahteine 8 years ago
parent
commit
2819228d4f
1 changed files with 30 additions and 23 deletions
  1. 30
    23
      buildroot/share/git/mfpub

+ 30
- 23
buildroot/share/git/mfpub View File

@@ -22,23 +22,21 @@ if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
22 22
   exit
23 23
 fi
24 24
 
25
+# Check out the named branch (or stay in current)
26
+git checkout $BRANCH
27
+
25 28
 if [[ $BRANCH == "gh-pages" ]]; then
26 29
   echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
27
-  bundle exec jekyll serve --watch
28 30
   exit
29 31
 fi
30 32
 
31 33
 if [[ $BRANCH != "master" ]]; then
34
+  echo "Stashing any changes to files..."
32 35
   echo "Don't forget to update and push 'master'!"
33 36
   # GOJF Card
34 37
   git stash
35 38
 fi
36 39
 
37
-# Check out the named branch (or stay in current)
38
-git checkout $BRANCH
39
-
40
-echo "Generating MarlinDocumentation..."
41
-
42 40
 COMMIT=$( git log --format="%H" -n 1 )
43 41
 
44 42
 # Clean out changes and other junk in the branch
@@ -48,28 +46,31 @@ git clean -d -f
48 46
 # Push 'master' to the fork and make a proper PR...
49 47
 if [[ $BRANCH == "master" ]]; then
50 48
 
51
-  if [[ $FORK == "MarlinFirmware" ]]; then
49
+  # Allow working directly with the main fork
50
+  echo -n "Pushing to origin/master... "
51
+  git push -f origin
52 52
 
53
-    # Allow working directly with the main fork
54
-    git push -f upstream
55
-
56
-  else
53
+  echo -n "Pushing to upstream/master... "
54
+  git push -f upstream
57 55
 
58
-    if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
56
+else
59 57
 
58
+  if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then
59
+    firstpush
60
+  else
61
+    echo -n "Pushing to origin/$BRANCH... "
60 62
     git push -f origin
63
+  fi
61 64
 
62
-    TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
63
-    URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
64
-
65
-    if [ -z "$TOOL" ]; then
66
-      echo "Can't find a tool to open the URL:"
67
-      echo $URL
68
-    else
69
-      echo "Opening a New PR Form..."
70
-      "$TOOL" "$URL"
71
-    fi
65
+  TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
66
+  URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
72 67
 
68
+  if [ -z "$TOOL" ]; then
69
+    echo "Can't find a tool to open the URL:"
70
+    echo $URL
71
+  else
72
+    echo "Opening a New PR Form..."
73
+    "$TOOL" "$URL"
73 74
   fi
74 75
 
75 76
 fi
@@ -78,6 +79,8 @@ fi
78 79
 # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
79 80
 # bundle install
80 81
 
82
+echo "Generating MarlinDocumentation..."
83
+
81 84
 # build the site statically and proof it
82 85
 bundle exec jekyll build --profile --trace --no-watch
83 86
 bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
@@ -90,7 +93,7 @@ rsync -av _site/ ${TMPFOLDER}/
90 93
 git reset --hard
91 94
 git clean -d -f
92 95
 
93
-# Sync built-site with gh-pages
96
+# Copy built-site into the gh-pages branch
94 97
 git checkout gh-pages
95 98
 rsync -av ${TMPFOLDER}/ ./
96 99
 
@@ -104,3 +107,7 @@ rm -rf ${TMPFOLDER}
104 107
 
105 108
 # Go back to the branch we started from
106 109
 git checkout $BRANCH
110
+
111
+if [[ $BRANCH != "master" ]]; then
112
+  git stash pop
113
+fi

Loading…
Cancel
Save