Skip to content

Commit

Permalink
Toph docs pipeline fixes bugs n gitbook (#12114)
Browse files Browse the repository at this point in the history
* WIP

* WIP2

* WIP3

* Remove comment/better comments

* Remote deployment updates

* Adds GH user for yarn deploy

* WIP 6

* WIP7

* WIP8

* WIP 10

* Working easy from home

not so much in the cloud
  • Loading branch information
supertopher authored Apr 19, 2022
1 parent 079e8b0 commit f065d36
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: compile-docusaurus-static-assets

on:
push:
branches: [master, toph_an_endless_persuit_of_docs]
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
verify-docusaurus-static-files:
deploy-docusaurus-to-docs-airbyte-io:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -26,9 +26,8 @@ jobs:
node-version: '16.13.0'
cache: 'yarn'
cache-dependency-path: docusaurus
# disabled for green build. more testing needed
# # Build Docusaurus website
# - name: Check for docusaurus changes
# - name: Check for docusaurus changes not committed
# run: ./tools/bin/check_docusaurus_build_changes
# # Install and build Docusaurus website
# - name: Deploy docs to production (it's weird)
Expand Down
4 changes: 2 additions & 2 deletions tools/bin/check_docusaurus_build_changes
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ set -o errexit
set +o xtrace

if test $clean -eq 0; then
echo -e "$red_text""\n\n\nDocusaurs has no changes to commit!""$default_text"
echo -e "$red_text""Generated documentation should be as local testing""$default_text"
echo -e "$blue_text""\n\n\nDocusaurs has no changes to commit!""$default_text"
echo -e "$blue_text""Generated documentation should be as local testing""$default_text"

else
echo -e "$red_text""\n\n\ndocusaurs build resulted in changes from this commit.""$default_text"
Expand Down
53 changes: 37 additions & 16 deletions tools/bin/deploy_docusaurus
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,20 @@ pwd


# Yarn check (which is commonly used to check for program existance)
# -s/--silent doesn't exist in cloud's Ubuntu
if ! which yarn > /dev/null; then
echo -e "$red_text""yarn not found HALP!!\n\n""$default_text"
exit 1
fi

set -o xtrace

# touch is non-destructive and the cloud doesn't have this file
touch $HOME/.gitconfig

# Set email and user name
if ! git config --list --global | grep --silent user.email; then
# local check for changes. Fail here early instead of 40 seconds from now
if ! test -z "$(git status --short)"; then
set +o xtrace
echo -e "$blue_text""github email not found adding Octavia's""$default_text"
set -o xtrace
git config --global user.email="[email protected]"
git config --global user.name="octavia-squidington-iii"
echo -e "$red_text""You have uncommitted changes!!!\n\n""$default_text"
echo -e "$red_text""Commit and try again""$default_text"
exit 1
fi

cd docusaurus
Expand All @@ -59,9 +56,23 @@ yarn install
# generate static content
yarn build

# context https://v1.docusaurus.io/docs/en/publishing#using-github-pages
# write a prod website to airbytehq/airbyte gh_pages branch
GIT_USER=octavia-squidington-iii yarn run deploy
# Check tty for local/remote deploys (we expect cloud to be non-interactive)
# results like /dev/ttys000 || not a tty
if test "$(tty)" == "not a tty"; then
set +o xtrace
echo -e "$blue_text""github email not found adding Octavia's""$default_text"
set -o xtrace
git config user.email="[email protected]"
git config user.name="octavia-squidington-iii"
echo "machine github.com login octavia-squidington-iii password $GITHUB_TOKEN" > $HOME/.netrc
# context https://v1.docusaurus.io/docs/en/publishing#using-github-pages
# write a prod website to airbytehq/airbyte gh_pages branch
# NOT ACTUALLY WORKING
GIT_USER="octavia-squidington-iii" yarn run publish-gh-pages
else
yarn run deploy
fi




Expand All @@ -71,8 +82,11 @@ pwd

# We should be here but we are playing with fire
git fetch
# We force push gh-pages. Local copies confuse things
# This line uses || true to enure we don't error if that branch doesn't exist
git branch -D gh-pages 2> /dev/null || true
# checkout the branch tracking it's remote
git switch gh-pages
git switch --track origin/gh-pages

# For tracking in the commit message
revision=$(git rev-parse --short HEAD)
Expand All @@ -94,11 +108,18 @@ git commit --message "Adds CNAME to deploy for $revision"
# non functional. for debugging
git branch

# note that this is NOT airbyte repo
git push --force https://$GITHUB_TOKEN@github.com/airbytehq/airbytehq.github.io.git
if test "$(tty)" == "not a tty"; then
# note that this is NOT airbyte repo
git push --force https://octavia-squidington-iii:$GITHUB_TOKEN@github.com/airbytehq/airbytehq.github.io.git
else
git push --force [email protected]:airbytehq/airbytehq.github.io.git
fi

# Let's leave the tire fire of force pushes
git checkout -


# Want to push from your own computer? uncomment this line and comment out the push above
# git push --force https://[email protected]/airbytehq/airbytehq.github.io.git

set +o xtrace
echo -e "$blue_text""Script exiting 0 GREAT SUCCESS!!!?""$default_text"

0 comments on commit f065d36

Please sign in to comment.