Skip to content

Commit

Permalink
Fix OSS integration tests for docs (#3663) (#20563)
Browse files Browse the repository at this point in the history
+ Changes 'deploy-docs-site' workflow and 'deploy_docusaurus'
  script so these two things are used for doc PR verification
  as well.
  • Loading branch information
tkorenko authored Dec 16, 2022
1 parent 6c807a4 commit 2720326
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 13 deletions.
58 changes: 45 additions & 13 deletions .github/workflows/deploy-docs-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ on:
paths:
- "docs/**"

pull_request:
types:
- opened
- reopened
- synchronize
paths:
- "docs/**"

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

jobs:
dummy-job:
name: Deploy Docs Assets
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
build-and-deploy-docs:
name: Build and Deploy Docs Assets
runs-on: ubuntu-latest
steps:
- name: Check out the repository
Expand All @@ -29,22 +36,47 @@ jobs:
cache: "yarn"
cache-dependency-path: docusaurus


- name: Run Docusaurus
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./tools/bin/deploy_docusaurus
run: |-
export SKIP_DEPLOY="yes"
if [ "${{github.event_name}}" = 'push' -o "${{github.event_name}}" = 'workflow_dispatch' ]; 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\":\"C02TYDSUM8F\",\"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 channel on failure
- name: Notify Slack -- deploy succeeded
if: always() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && job.status == 'success'
uses: abinoda/slack-action@master
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
# 'C032Y32T065' channel => '#docs'
# 'C02TYDSUM8F' => '#dev-deploys'
# 'C03BEADRPNY' => '#docs'
args: >-
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
{\"type\":\"divider\"},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"OSS Docs build fails on the latest master :bangbang: \n\n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-shocked: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-shocked: \n\"}},
{\"type\":\"divider\"}]}
{\"channel\":\"C02TYDSUM8F\",\"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>\"}}
]}]}
11 changes: 11 additions & 0 deletions tools/bin/deploy_docusaurus
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,19 @@ if test "$(tty)" == "not a tty"; then
else
yarn run deploy
fi
YARN_DEPLOY_EXIT_STATUS=$?


# At this moment we have a bunch of changed files in Git (local) working
# directory. What is left -- is pushing changes back to Git repo to
# make changes available to everyone. However, this same script is
# used to validate "deployability" of Github PRs. And while we are in
# "check PR mode" -- we do not want to push changes back to Git repo:
if [ "${SKIP_DEPLOY}" = "yes" ]; then
echo -e "$blue_text""Check mode is ON: skipipping Git push to git repo!\n\n""$default_text"
exit $YARN_DEPLOY_EXIT_STATUS
fi


# Git makes more sense from /
cd ..
Expand Down

0 comments on commit 2720326

Please sign in to comment.