-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deploy integration (gh pages) (#21)
* feat: gh pages deploy on merge to main or workflow dispatch * fix: url for github pages? * netlify-deploy * fix: secrets * url hostname * fix: deploy with action instead * feat: status check with action push to non prod deploy * attempt header overwrite for CORS * TODO: UNDO ME simplify build times * f * simplify sync docs for now * f * idk man * direct widget * rm non working hacky patches for AI cors * fix: github loc and todo * url * deploy to gh pages
- Loading branch information
1 parent
63c3483
commit 5466866
Showing
6 changed files
with
159 additions
and
2 deletions.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
permissions: | ||
contents: write | ||
actions: write | ||
pages: write | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to GitHub Pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: 🤔 Sync latest Upstream | ||
run: make sync-docs | ||
|
||
- name: Build website 🔨 | ||
run: make build-docs | ||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: build | ||
single-commit: true |
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,81 @@ | ||
name: 'Netlify Deploy' | ||
|
||
# Disable `Pretty URLs` (Site Confiuration > Build & Deploy > Post Processing > Pretty URLs) | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
on: | ||
# TODO: cron | ||
# release: | ||
# types: [published] | ||
push: | ||
# branches: | ||
# - main | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
|
||
jobs: | ||
deploy: | ||
name: 'Deploy to Netlify' | ||
runs-on: ubuntu-latest | ||
steps: | ||
# ensure the secrets are set, if not, error | ||
- name: Check Secrets | ||
run: | | ||
if [ -z "${{ secrets.NETLIFY_SITE_ID }}" ]; then | ||
echo "NETLIFY_SITE_ID is not set. Please set it in the repository secrets." | ||
exit 1 | ||
fi | ||
if [ -z "${{ secrets.NETLIFY_AUTH_TOKEN }}" ]; then | ||
echo "NETLIFY_AUTH_TOKEN is not set. Please set it in the repository secrets." | ||
exit 1 | ||
fi | ||
- name: Repository Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup NodeJS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
|
||
- name: Install Netlify | ||
run: npm install [email protected] -g | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: 🤔 Sync latest Upstream | ||
run: make sync-docs | ||
|
||
- name: Build website 🔨 | ||
run: make build-docs | ||
|
||
# if the branch is not main, then its a deploy to non prod, set DEPLOY_TO_PROD to false | ||
- name: Set Deploy to Prod | ||
run: | | ||
if [ "${{ env.BRANCH_NAME }}" != "main" ]; then | ||
echo "Deploying to non-prod environment" | ||
echo "Setting DEPLOY_TO_PROD to false" | ||
echo "DEPLOY_TO_PROD=false" >> $GITHUB_ENV | ||
else | ||
echo "Deploying to prod environment" | ||
echo "Setting DEPLOY_TO_PROD to true" | ||
echo "DEPLOY_TO_PROD=true" >> $GITHUB_ENV | ||
fi | ||
# https://app.netlify.com/user/applications#personal-access-tokens | ||
# ref: https://www.raulmelo.me/en/blog/deploying-netlify-github-actions-guide | ||
# ref: NETLIFY_SITE_ID is a UUID from Netlify | ||
- name: Deploy to Netlify | ||
uses: jsmrcaga/[email protected] | ||
with: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
NETLIFY_DEPLOY_MESSAGE: "Deployed from GitHub action" | ||
NETLIFY_DEPLOY_TO_PROD: ${{ env.DEPLOY_TO_PROD }} | ||
install_command: "echo Skipping installing the dependencies" | ||
build_command: "echo Skipping building the web files" |
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,31 @@ | ||
|
||
## build-docs: Build the documentation to static files. | ||
.PHONY: build-docs | ||
build-docs: | ||
@npm ci && npm run build | ||
|
||
## serve-docs: Run docs server | ||
.PHONY: serve-docs | ||
serve-docs: | ||
@npm run serve | ||
|
||
## dev-docs: Run dev docs instance | ||
.PHONY: dev-docs | ||
dev-docs: | ||
@npm run start | ||
|
||
## sync-docs: Grab the latest upstream documentation | ||
.PHONY: sync-docs | ||
sync-docs: | ||
@bash sync_cosmos-sdk.sh | ||
@bash sync_ibc.sh | ||
|
||
.PHONY: help | ||
help: Makefile | ||
@echo | ||
@echo " Choose a command run in 'dev-portal'" | ||
@echo | ||
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' | ||
@echo | ||
|
||
|
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,2 @@ | ||
/* | ||
Access-Control-Allow-Origin: * |
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
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,5 @@ | ||
# a request to `https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app/proxy/query/v2/chat/stream/` is made but results in a CORS error with netlify. Fix this using a redirect | ||
[[headers]] | ||
for = "/*" # you can configure the correct paths here | ||
[headers.values] | ||
access-control-allow-origin = "*" # see a list of allowed values here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin |