diff --git a/.github/workflows/deploy-docs-site.yml b/.github/workflows/deploy-docs-site.yml index 497804a288ff..0a66469b9bc5 100644 --- a/.github/workflows/deploy-docs-site.yml +++ b/.github/workflows/deploy-docs-site.yml @@ -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 diff --git a/tools/bin/deploy_docusaurus b/tools/bin/deploy_docusaurus index fcfaa900ae68..07eab74a2609 100755 --- a/tools/bin/deploy_docusaurus +++ b/tools/bin/deploy_docusaurus @@ -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" @@ -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 @@ -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="octavia-squidington-iii@users.noreply.github.com" - git config user.name="octavia-squidington-iii" + git config --global user.email "octavia-squidington-iii@users.noreply.github.com" + 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 @@ -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 git@github.com: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"