-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate docs for the CLI #40
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b59c06
Add command to generate docs for the CLI using pandoc
e8d5ab7
Add job to build docs and store them in artifacts
cda5b2f
Store the artifacts under an alias
c86af1e
Deploy docs to gh-pages after updating index
a47d082
Only build docs on deploy
0cfb929
Move pandoc outside of go command and page setup from deploy script
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,16 @@ jobs: | |
destination: coverage.txt | ||
- codecov/upload: | ||
path: coverage.txt | ||
docs: | ||
executor: go | ||
steps: | ||
- checkout | ||
- run: sudo apt-get install pandoc | ||
- run: go run main.go usage | ||
- store_artifacts: | ||
path: ./docs | ||
destination: docs | ||
- run: ./.circleci/deploy-gh-pages.sh | ||
|
||
lint: | ||
docker: | ||
|
@@ -55,8 +65,8 @@ jobs: | |
- run: | ||
name: Tag Repo | ||
command: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Marc O'Morain" | ||
git config --global user.email $GH_EMAIL | ||
git config --global user.name $GH_NAME | ||
git tag -a "v0.1.$CIRCLE_BUILD_NUM" -m "Release v0.1.$CIRCLE_BUILD_NUM" | ||
git push origin "v0.1.$CIRCLE_BUILD_NUM" | ||
- run: | ||
|
@@ -81,6 +91,9 @@ workflows: | |
- test | ||
- coverage | ||
- lint | ||
- docs: | ||
requires: | ||
- deploy | ||
- deploy: | ||
requires: | ||
- test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
# ideas used from https://gist.github.com/motemen/8595451 | ||
|
||
# Based on https://github.com/eldarlabs/ghpages-deploy-script/blob/master/scripts/deploy-ghpages.sh | ||
# Used with their MIT license https://github.com/eldarlabs/ghpages-deploy-script/blob/master/LICENSE | ||
|
||
# abort the script if there is a non-zero error | ||
set -e | ||
|
||
# show where we are on the machine | ||
pwd | ||
remote=$(git config remote.origin.url) | ||
|
||
# make a directory to put the gp-pages branch | ||
mkdir gh-pages-branch | ||
cd gh-pages-branch | ||
# now lets setup a new repo so we can update the gh-pages branch | ||
git config --global user.email "$GH_EMAIL" > /dev/null 2>&1 | ||
git config --global user.name "$GH_NAME" > /dev/null 2>&1 | ||
git init | ||
git remote add --fetch origin "$remote" | ||
|
||
# switch into the the gh-pages branch | ||
if git rev-parse --verify origin/gh-pages > /dev/null 2>&1 | ||
then | ||
git checkout gh-pages | ||
# delete any old site as we are going to replace it | ||
# Note: this explodes if there aren't any, so moving it here for now | ||
git rm -rf . | ||
else | ||
git checkout --orphan gh-pages | ||
fi | ||
|
||
# copy over or recompile the new site | ||
cp -a "../out/." . | ||
|
||
# stage any changes and new files | ||
git add -A | ||
# now commit, ignoring branch gh-pages doesn't seem to work, so trying skip | ||
git commit --allow-empty -m "Deploy to GitHub pages [ci skip]" | ||
# and push, but send any output to /dev/null to hide anything sensitive | ||
git push --force --quiet origin gh-pages | ||
# go back to where we started and remove the gh-pages git repo we made and used | ||
# for deployment | ||
cd .. | ||
rm -rf gh-pages-branch | ||
|
||
echo "Finished Deployment!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# generate markdown docs | ||
go run main.go usage | ||
|
||
# setup output dir | ||
mkdir -p out | ||
|
||
# pandoc markdown to html into out dir | ||
for f in docs/*.md; do | ||
pandoc "$f" -s -o "out/$(basename ${f%.md}.html)"; | ||
done | ||
|
||
# move index and update links | ||
mv out/circleci.html out/index.html | ||
sed -i -- 's#<a href="circleci.html">#<a href="index.html">#g' out/*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ TODO | |
circleci-cli | ||
coverage.txt | ||
dist/ | ||
docs/ | ||
out/ | ||
.vscode |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit of magic was in their FAQ 🙌
https://pandoc.org/faqs.html#how-can-i-convert-a-whole-directory-of-files-from-markdown-to-rtf