|
@@ -2,7 +2,11 @@
|
2
|
2
|
#
|
3
|
3
|
# mfpub
|
4
|
4
|
#
|
5
|
|
-# Use Jekyll to publish Marlin Documentation to the HTML site
|
|
5
|
+# Use Jekyll to generate Marlin Documentation, which is then
|
|
6
|
+# git-pushed to Github to publish it to the live site.
|
|
7
|
+# This publishes the current branch, and doesn't force
|
|
8
|
+# changes to be pushed to the 'master' branch. Be sure to push
|
|
9
|
+# any permanent changes to 'master'.
|
6
|
10
|
#
|
7
|
11
|
|
8
|
12
|
MFINFO=$(mfinfo "$@") || exit
|
|
@@ -19,23 +23,22 @@ if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
|
19
|
23
|
fi
|
20
|
24
|
|
21
|
25
|
if [[ $BRANCH == "gh-pages" ]]; then
|
22
|
|
- echo "Can't build from 'gh-pages.' Only the Jekyll branches."
|
|
26
|
+ echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
|
23
|
27
|
bundle exec jekyll serve --watch
|
24
|
28
|
exit
|
25
|
29
|
fi
|
26
|
30
|
|
27
|
31
|
if [[ $BRANCH != "master" ]]; then
|
28
|
32
|
echo "Don't forget to update and push 'master'!"
|
|
33
|
+ # GOJF Card
|
|
34
|
+ git stash
|
29
|
35
|
fi
|
30
|
36
|
|
|
37
|
+# Check out the named branch (or stay in current)
|
31
|
38
|
git checkout $BRANCH
|
32
|
39
|
|
33
|
40
|
echo "Generating MarlinDocumentation..."
|
34
|
41
|
|
35
|
|
-# GOJF Card
|
36
|
|
-git stash
|
37
|
|
-
|
38
|
|
-TMPFOLDER=$( mktemp -d )
|
39
|
42
|
COMMIT=$( git log --format="%H" -n 1 )
|
40
|
43
|
|
41
|
44
|
# Clean out changes and other junk in the branch
|
|
@@ -45,19 +48,28 @@ git clean -d -f
|
45
|
48
|
# Push 'master' to the fork and make a proper PR...
|
46
|
49
|
if [[ $BRANCH == "master" ]]; then
|
47
|
50
|
|
48
|
|
- if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
49
|
|
-
|
50
|
|
- git push -f origin
|
|
51
|
+ if [[ $$FORK == "MarlinFirmware" ]]; then
|
51
|
52
|
|
52
|
|
- TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
|
53
|
|
- URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
|
|
53
|
+ # Allow working directly with the main fork
|
|
54
|
+ git push -f upstream
|
54
|
55
|
|
55
|
|
- if [ -z "$TOOL" ]; then
|
56
|
|
- echo "Can't find a tool to open the URL:"
|
57
|
|
- echo $URL
|
58
|
56
|
else
|
59
|
|
- echo "Opening a New PR Form..."
|
60
|
|
- "$TOOL" "$URL"
|
|
57
|
+
|
|
58
|
+ if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
|
59
|
+
|
|
60
|
+ git push -f origin
|
|
61
|
+
|
|
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
|
|
72
|
+
|
61
|
73
|
fi
|
62
|
74
|
|
63
|
75
|
fi
|
|
@@ -66,9 +78,12 @@ fi
|
66
|
78
|
# mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
|
67
|
79
|
# bundle install
|
68
|
80
|
|
|
81
|
+# build the site statically and proof it
|
69
|
82
|
bundle exec jekyll build --profile --trace --no-watch
|
70
|
83
|
bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
|
71
|
84
|
|
|
85
|
+# Sync the built site into a temporary folder
|
|
86
|
+TMPFOLDER=$( mktemp -d )
|
72
|
87
|
rsync -av _site/ ${TMPFOLDER}/
|
73
|
88
|
|
74
|
89
|
# Clean out changes and other junk in the branch
|
|
@@ -84,6 +99,7 @@ git add --all
|
84
|
99
|
git commit --message "Built from ${COMMIT}"
|
85
|
100
|
git push upstream
|
86
|
101
|
|
|
102
|
+# remove the temporary folder
|
87
|
103
|
rm -rf ${TMPFOLDER}
|
88
|
104
|
|
89
|
105
|
# Go back to the branch we started from
|