-
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: onboarding docs with spawn (#22)
* onboarding wip * rm onboarding raw docs * fix gitignore * rm netlify for now * add spawn to onboarding docs * remoev default docs/ dir * fix: onboarding to local reference * sync_onboarding.sh
- Loading branch information
1 parent
8ed06e8
commit 3c28ad0
Showing
8 changed files
with
160 additions
and
98 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 |
---|---|---|
@@ -1,81 +1,81 @@ | ||
name: 'Netlify Deploy' | ||
# name: 'Netlify Deploy' | ||
|
||
# Disable `Pretty URLs` (Site Confiuration > Build & Deploy > Post Processing > Pretty URLs) | ||
# # Disable `Pretty URLs` (Site Confiuration > Build & Deploy > Post Processing > Pretty URLs) | ||
|
||
permissions: | ||
pull-requests: write | ||
# permissions: | ||
# pull-requests: write | ||
|
||
on: | ||
# TODO: cron | ||
# release: | ||
# types: [published] | ||
push: | ||
# branches: | ||
# - main | ||
# on: | ||
# # TODO: cron | ||
# # release: | ||
# # types: [published] | ||
# push: | ||
# # branches: | ||
# # - main | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
# 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 | ||
# 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: Repository Checkout | ||
# uses: actions/checkout@v4 | ||
|
||
- name: Setup NodeJS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
# - 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 Netlify | ||
# run: npm install [email protected] -g | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
# - name: Install Dependencies | ||
# run: npm ci | ||
|
||
- name: 🤔 Sync latest Upstream | ||
run: make sync-docs | ||
# - name: 🤔 Sync latest Upstream | ||
# run: make sync-docs | ||
|
||
- name: Build website 🔨 | ||
run: make build-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 | ||
# # 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" | ||
# # 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 |
---|---|---|
|
@@ -30,3 +30,4 @@ dsource* | |
ibc-go* | ||
cometbft* | ||
cosmos-sdk* | ||
onboarding* |
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 was deleted.
Oops, something went wrong.
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
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,68 @@ | ||
#!/bin/bash | ||
# | ||
# To run this script, ensure you have setup the docusaurus.config.js first for new repos. | ||
# This then migrates it over to here. | ||
# | ||
|
||
CURRENT_DIR=$(pwd) | ||
source ./sync_helpers.sh | ||
DOCS_NAME=onboarding | ||
|
||
DOCS_DIR_TARGET=dsource-onboarding | ||
DOCS_DIR=$CURRENT_DIR/$DOCS_DIR_TARGET/docs | ||
|
||
main() { | ||
download_docs_source | ||
|
||
copy_over_core | ||
|
||
fix_references | ||
# fix_components | ||
} | ||
|
||
# == HELPER FUNCTIONS == | ||
unsafe_cleanup_ibc_go() { | ||
# useful for testing this script locally and resetting state | ||
rm -rf ./$DOCS_NAME ./${DOCS_NAME}_versioned_sidebars ./${DOCS_NAME}_versioned_docs ./static/img/$DOCS_NAME/ ./src/components/$DOCS_NAME/ | ||
rm -rf ./$DOCS_DIR ./${DOCS_NAME}_versions.json | ||
} | ||
|
||
|
||
download_docs_source() { | ||
# Downloads documentation source for the repo | ||
git -C "$DOCS_DIR_TARGET" pull || git clone --depth 1 https://github.com/rollchains/spawn.git $DOCS_DIR_TARGET | ||
|
||
if [ -z "$DOCS_NAME" ]; then | ||
echo "DOCS_NAME is unset. Set it to the name of the docs you are syncing (i.e. ibc-go)." | ||
panic | ||
fi | ||
|
||
mkdir -p ./$DOCS_NAME ./${DOCS_NAME}_versioned_sidebars ./${DOCS_NAME}_versioned_docs ./static/img/$DOCS_NAME/ | ||
} | ||
|
||
copy_over_core() { | ||
# docs | ||
cp -r $DOCS_DIR/docs ./${DOCS_NAME} | ||
|
||
# versioned docs | ||
cp $DOCS_DIR/versions.json ./${DOCS_NAME}_versions.json | ||
cp -r $DOCS_DIR/versioned_sidebars/* ./${DOCS_NAME}_versioned_sidebars | ||
cp -r $DOCS_DIR/versioned_docs/* ./${DOCS_NAME}_versioned_docs | ||
|
||
# core | ||
cp $DOCS_DIR/sidebars.js ./${DOCS_NAME}/sidebars.js | ||
|
||
# images | ||
cp -r $DOCS_DIR/static/img/* ./static/img/${DOCS_NAME}/ | ||
} | ||
|
||
fix_references() { | ||
# update component import references | ||
# replace "./src/components/${DOCS_NAME}" "static/img/" "static/img/${DOCS_NAME}/" | ||
|
||
replace "./${DOCS_NAME}_versioned_docs" '<!-- markdown-link-check-disable -->' '' | ||
replace "./${DOCS_NAME}_versioned_docs" '<!-- markdown-link-check-enable -->' '' | ||
} | ||
|
||
# == MAIN == | ||
main |