Skip to content

Commit

Permalink
Move website tasks into Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed May 10, 2021
1 parent b0ad1f9 commit 9177a6f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 55 deletions.
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
.PHONY: build-website
build-website:
echo -e "\033[0;32mBuilding website...\033[0m"

# Ensure we start from a clean state
rm -rf target/website

# Copy the entire website directory to target/website
cp -r website/ target/

# Generate the compiler API docs
cargo doc --no-deps --workspace

# Move the API docs into the compiler-docs subdirectory within the website
mv target/doc target/website/compiler-docs

# Generate the Fe guide into the docs subdirectory within the website
cd docs; mdbook build -d ../target/website/docs

.PHONY: serve-website
serve-website: build-website
echo -e "\033[0;32mServing website locally...\033[0m"
cd target/website; python3 -m http.server 8000

.PHONY: deploy-website
deploy-website: build-website
echo -e "\033[0;32mDeploying website...\033[0m"
# delete old gh-pages-tmp branch if it exists
-git branch -D gh-pages-tmp

# Recreate it
git checkout -b gh-pages-tmp

# Add changes to git.
git add -f target/website

# Commit changes.
git commit -m "Generated website"

# Only preserve target/website as the root of contents for this branch
git subtree split -P target/website -b gh-pages-dist

# Push to Github Pages
git push -f upstream gh-pages-dist:gh-pages

# Go where we came from
git checkout -

# Delete temporary branches
git branch -D gh-pages-tmp
git branch -D gh-pages-dist

.PHONY: docker-test
docker-test:
docker run \
Expand Down
55 changes: 0 additions & 55 deletions deploy-website.sh

This file was deleted.

0 comments on commit 9177a6f

Please sign in to comment.