Skip to content

Deploy PR previews to branch folders #284

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

Merged
merged 6 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions site/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@ SRC_DIR := _source/developer-framework
DEST_DIR_NB := notebooks
DEST_DIR_PYTHON := _site/validmind
DEST_DIR_TESTS := tests
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

# Define .PHONY target for help section
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-prod release-notes
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-demo-branch delete-demo-branch deploy-prod release-notes

# Help section
help:
@echo "Available targets:"
@echo " clean Remove the _source/ directory"
@echo " clone Clone the developer-framework repository into _source/"
@echo " notebooks Copy Jupyter notebooks into notebooks/"
@echo " python-docs Copy the Python library docs into _site/validmind"
@echo " get-source Get all source files (clean, clone, notebooks, python-docs)"
@echo " docs-site Get all source files and render the docs site with Quarto"
@echo " deploy-demo Render the docs site & deploy to docs-ci-cd-demo and clear cache"
@echo " deploy-prod Render the docs site & deploy to docs-ci-cd-prod and clear cache"
@echo " help Display this help message (default target)"
@echo " release-notes Generate release notes from pull requests since latest tag and update _quarto.yml"
@echo " clean Remove the _source/ directory"
@echo " clone Clone the developer-framework repository into _source/"
@echo " notebooks Copy Jupyter notebooks into notebooks/"
@echo " python-docs Copy the Python library docs into _site/validmind"
@echo " get-source Get all source files (clean, clone, notebooks, python-docs)"
@echo " docs-site Get all source files and render the docs site with Quarto"
@echo " deploy-demo Deploy docs demo site to s3://docs-ci-cd-demo/site/"
@echo " deploy-demo-branch Deploy docs demo site to s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/"
@echo " delete-demo-branch Delete docs demo site in s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/"
@echo " deploy-prod Deploy docs prod site to s3://docs-ci-cd-prod/site/"
@echo " help Display this help message (default target)"
@echo " release-notes Generate release notes from pull requests since latest tag and update _quarto.yml"

# Clean up source directory
clean:
Expand Down Expand Up @@ -82,9 +85,19 @@ deploy-demo:
echo "You're not on the docs-demo branch, no action taken."; \
else \
echo "\nDeploying docs-demo site ..."; \
quarto render && aws s3 sync ./_site s3://docs-ci-cd-demo/site/ --delete && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null; \
quarto render && aws s3 sync ./_site s3://docs-ci-cd-demo/site/ && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null; \
fi

# Deploy PR branch to https://docs-demo.vm.validmind.ai/
deploy-demo-branch:
@quarto render && aws s3 sync ./_site s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/ --delete && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null;
@echo "\nDeployed to https://docs-demo.vm.validmind.ai/pr_previews/$(GIT_BRANCH)/index.html"

# Delete PR branch on https://docs-demo.vm.validmind.ai/
delete-demo-branch:
@aws s3 rm s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/ --recursive && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null;
@echo "\nDeleted https://docs-demo.vm.validmind.ai/pr_previews/$(GIT_BRANCH)/"

# Deployment to https://docs.validmind.ai/
deploy-prod:
@if [ "`git rev-parse --abbrev-ref HEAD`" != "prod" ]; then \
Expand Down
Loading