1
0
mirror of synced 2025-12-19 18:14:56 -05:00

Move docs.airbyte.com hosting to Vercel (#30591)

This commit is contained in:
Evan Tahler
2023-09-19 14:52:10 -07:00
committed by GitHub
parent 354a2a49bc
commit 3c113a24b0
2 changed files with 0 additions and 227 deletions

View File

@@ -1,85 +0,0 @@
name: Deploy docs.airbyte.com
on:
push:
branches:
- master
paths:
- "docs/**"
- "docusaurus/**"
pull_request:
types:
- closed
- opened
- reopened
- synchronize
paths:
- "docs/**"
- "docusaurus/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-and-deploy-docs:
name: Build and Deploy Docs Assets
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# Node.js is needed for Yarn
- name: Setup Yarn
uses: actions/setup-node@v3
with:
node-version: "16.14.0"
cache: "yarn"
cache-dependency-path: docusaurus
- name: Run Docusaurus
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_APPROVINGTON_OCTAVIA }}
run: |-
export SKIP_DEPLOY="yes"
if [ "${{github.event_name}}" = 'push' -o "${{github.event_name}}" = 'workflow_dispatch' -o "${{github.event.pull_request.merged}}" = 'true' ]; then
export SKIP_DEPLOY="no"
fi
./tools/bin/deploy_docusaurus
- name: Notify Slack -- deploy failed
if: always() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && job.status != 'success'
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
# 'C02TYDSUM8F' => '#dev-deploys'
# 'C03BEADRPNY' => '#docs'
args: >-
{\"channel\":\"C03BEADRPNY\",\"attachments\":[
{\"color\":\"#ff0000\",\"blocks\":[
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"OSS Docs deploy fails on the latest master :bangbang:\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}*\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run>\"}}
]}]}
- name: Notify Slack -- deploy succeeded
if: always() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && job.status == 'success'
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
# 'C02TYDSUM8F' => '#dev-deploys'
# 'C03BEADRPNY' => '#docs'
args: >-
{\"channel\":\"C03BEADRPNY\",\"attachments\":[
{\"color\":\"#00ff00\",\"blocks\":[
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"OSS Docs deploy was successful :tada:\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}*\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run>\"}}
]}]}

View File

@@ -1,142 +0,0 @@
#!/usr/bin/env bash
# ------------- Import some defaults for the shell
# Source shell defaults
# $0 is the currently running program (this file)
this_file_directory=$(dirname $0)
relative_path_to_defaults=$this_file_directory/../shell_defaults
SKIP_DEPLOY=${SKIP_DEPLOY:-'no'}
# if a file exists there, source it. otherwise complain
if test -f $relative_path_to_defaults; then
# source and '.' are the same program
source $relative_path_to_defaults
else
echo -e "\033[31m\nFAILED TO SOURCE TEST RUNNING OPTIONS.\033[39m"
echo -e "\033[31mTried $relative_path_to_defaults\033[39m"
exit 1
fi
# if a string
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"
echo -e "$red_text""You will need to change your remote to continue. Yell @topher for help""$default_text"
echo -e "$red_text""change your remote command:""$default_text"
echo -e "$red_text""git remote set-url origin git@github.com:airbytehq/airbyte.git""$default_text"
exit 1
fi
# ------------- Start Main
set +o xtrace
echo -e "$blue_text""This script pushes changes to ""$default_text"
echo -e "$blue_text""airbyte's gh_pages branch\n""$default_text"
echo -e "$blue_text""Current path:""$default_text"
pwd
# Yarn check (which is commonly used to check for program existence)
# -s/--silent doesn't exist in cloud's Ubuntu
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
fi
if ! which yarn > /dev/null; then
echo -e "$red_text""yarn not found HALP!!\n\n""$default_text"
echo -e "$red_text""try this: brew install yarn\n\n""$default_text"
exit 1
fi
set -o xtrace
# 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 "$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
pwd
# install packages
yarn install
# generate static content
if ! yarn build; then
echo -e "$red_text""yarn build has failed. Documentation probably has broken links""$default_text"
echo -e "$red_text""please fix the links, commit, and try again""$default_text"
exit 1
fi
# "check PR mode" -- we run "yarn build" and stop before "yarn deploy"
if [ "${SKIP_DEPLOY}" = "yes" ]; then
echo -e "$blue_text""Check mode is ON: skipipping yarn deploy && git push CNAME to repo!\n\n""$default_text"
exit 0
fi
# 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 --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
# '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
# 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 --track origin/gh-pages
# For tracking in the commit message
revision=$(git rev-parse --short HEAD)
# explained at length below
set +o xtrace
echo -e "$blue_text""Writing CNAME file!\n\n""$default_text"
set -o xtrace
# This is a weird one. GH Pages expects a CNAME file when redirecting
# we redirect docs.airbyte.io to airbytehq.github.io
# this tells github to expect docs.airbyte.com points to us
echo "docs.airbyte.com" > CNAME
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"
# These are raw static files, we aren't trying to resolve conflicts
git push --force
# non functional. for debugging
git rev-parse --abbrev-ref HEAD
git checkout -
set +o xtrace
echo -e "$blue_text""Script exiting 0 GREAT SUCCESS!!!?""$default_text"