Skip to content

Commit

Permalink
Simplify the OSS documentation deploy system (#2670) (#18436)
Browse files Browse the repository at this point in the history
+ Updates tools/bin/deploy_docusaurus to work on Github Runners
+ Adds 'Deploy docs.airbyte.com' Github workflow
  • Loading branch information
tkorenko authored Oct 27, 2022
1 parent 22a3fce commit a9a2bd4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/deploy-docs-site.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
name: Deploy docs.airbyte.com [DUMMY workflow]
name: Deploy docs.airbyte.com

on:
## XXX uncomment the following when this code gets in good shape
#push:
# branches:
# - master
# paths:
# - 'docs/**'
push:
branches:
- master
paths:
- 'docs/**'

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

jobs:
dummy-job:
name: A placeholder job
name: Deploy Docs Assets
runs-on: ubuntu-latest
steps:
- name: A placeholder step
shell: bash
run: |-
echo "Hello from 'Deploy Docs' workflow!"
- name: Check out the repository
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
fetch-depth: 0

# Node.js is needed for Yarn
- name: Setup Yarn
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/setup-node@v2
with:
node-version: '16.14.0'
cache: 'yarn'
cache-dependency-path: docusaurus

- name: Run Docusaurus
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./tools/bin/deploy_docusaurus
29 changes: 9 additions & 20 deletions tools/bin/deploy_docusaurus
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
fi

# if a string
if $(git remote get-url origin | grep --quiet "http"); then
if test "$(tty)" != "not a tty" && $(git remote get-url origin | grep --quiet "http"); then
set +o xtrace
echo -e "$red_text""This program requires a ssh-based github repo""$default_text"
echo -e "$red_text""https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account""$default_text"
Expand All @@ -41,9 +41,9 @@ echo -e "$blue_text""Current path:""$default_text"
pwd


# Yarn check (which is commonly used to check for program existance)
# Yarn check (which is commonly used to check for program existence)
# -s/--silent doesn't exist in cloud's Ubuntu
if ! which brew > /dev/null; then
if [[ `uname -s` = 'Darwin' && ! `which brew` ]] > /dev/null; then
echo -e "$red_text""homebrew not found HALP!!\n\n""$default_text"
echo -e "$red_text""try this: https://brew.sh\n\n""$default_text"
exit 1
Expand Down Expand Up @@ -85,20 +85,19 @@ 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"
git config --global user.email "[email protected]"
git config --global 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
# 'publish-gh-pages' NOT ACTUALLY WORKING, we use 'deploy' instead:
GIT_USER="octavia-squidington-iii" yarn run deploy
else
yarn run deploy
fi




# Git makes more sense from /
cd ..
pwd
Expand Down Expand Up @@ -129,21 +128,11 @@ git add CNAME
# Skip pre-commit hooks fire_elmo.jpg
PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit --message "Adds CNAME to deploy for $revision"

git push

# non functional. for debugging
git rev-parse --abbrev-ref HEAD

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

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

0 comments on commit a9a2bd4

Please sign in to comment.