Browse Source

Better mfpub

Scott Lahteine 8 years ago
parent
commit
60a4ca1182
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
   exit
22
   exit
23
 fi
23
 fi
24
 
24
 
25
+# Check out the named branch (or stay in current)
26
+git checkout $BRANCH
27
+
25
 if [[ $BRANCH == "gh-pages" ]]; then
28
 if [[ $BRANCH == "gh-pages" ]]; then
26
   echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
29
   echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
27
-  bundle exec jekyll serve --watch
28
   exit
30
   exit
29
 fi
31
 fi
30
 
32
 
31
 if [[ $BRANCH != "master" ]]; then
33
 if [[ $BRANCH != "master" ]]; then
34
+  echo "Stashing any changes to files..."
32
   echo "Don't forget to update and push 'master'!"
35
   echo "Don't forget to update and push 'master'!"
33
   # GOJF Card
36
   # GOJF Card
34
   git stash
37
   git stash
35
 fi
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
 COMMIT=$( git log --format="%H" -n 1 )
40
 COMMIT=$( git log --format="%H" -n 1 )
43
 
41
 
44
 # Clean out changes and other junk in the branch
42
 # Clean out changes and other junk in the branch
48
 # Push 'master' to the fork and make a proper PR...
46
 # Push 'master' to the fork and make a proper PR...
49
 if [[ $BRANCH == "master" ]]; then
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
     git push -f origin
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
   fi
74
   fi
74
 
75
 
75
 fi
76
 fi
78
 # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
79
 # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
79
 # bundle install
80
 # bundle install
80
 
81
 
82
+echo "Generating MarlinDocumentation..."
83
+
81
 # build the site statically and proof it
84
 # build the site statically and proof it
82
 bundle exec jekyll build --profile --trace --no-watch
85
 bundle exec jekyll build --profile --trace --no-watch
83
 bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
86
 bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
90
 git reset --hard
93
 git reset --hard
91
 git clean -d -f
94
 git clean -d -f
92
 
95
 
93
-# Sync built-site with gh-pages
96
+# Copy built-site into the gh-pages branch
94
 git checkout gh-pages
97
 git checkout gh-pages
95
 rsync -av ${TMPFOLDER}/ ./
98
 rsync -av ${TMPFOLDER}/ ./
96
 
99
 
104
 
107
 
105
 # Go back to the branch we started from
108
 # Go back to the branch we started from
106
 git checkout $BRANCH
109
 git checkout $BRANCH
110
+
111
+if [[ $BRANCH != "master" ]]; then
112
+  git stash pop
113
+fi

Loading…
Cancel
Save