Add vendor pages experiment to docs #1407
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: On PR, Build, Publish to Azure Bucket | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
#env: | |
#SITE_DIR: ${{ github.ref }} | |
#SITE_DIR: subsite | |
on: | |
workflow_dispatch: | |
# We have another workflow for pushing directly to dev | |
push: | |
branches: | |
- 'dev' | |
tags: | |
- test-* | |
pull_request: | |
types: [opened, reopened] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-html: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Get branch name | |
id: getbr | |
uses: tj-actions/branch-names@v6 | |
- name: Get the branch output | |
run: echo "The output of get-branch is ${{ steps.getbr.outputs.ref_branch }}" | |
- name: Remove last part of PR ref | |
uses: mad9000/actions-find-and-replace-string@3 | |
id: findandreplace | |
with: | |
source: 'pr${{ steps.getbr.outputs.ref_branch }}' | |
find: '/merge' | |
replace: '' | |
- name: Get the above output | |
run: echo "The output of findandreplace is $Deployment_Dir" | |
- name: BuildHasTag | |
if: ${{ github.ref_type=='tag' }} | |
run: | | |
echo "Setting Deployment_Dir to tag-${{ github.ref_name }} -- ${{ github.ref_type }}" | |
echo "Deployment_Dir=tag-${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: BuildHasNoTag | |
if: ${{ github.ref_type!='tag' }} | |
run: | | |
echo "Setting Deployment_Dir to ${{ steps.findandreplace.outputs.value }} -- BLAH" | |
echo "Deployment_Dir=${{ steps.findandreplace.outputs.value }}" >> $GITHUB_ENV | |
- name: blob | |
run: echo $Deployment_Dir | |
- name: Checkout Dev | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- run: python -m pip install --upgrade pip setuptools wheel | |
# Needed when using more than one repo | |
# add 'monorepo' to mkdocs.yml file under plugins | |
- run: pip install mkdocs-monorepo-plugin | |
# Adds requirements for social plugin. Needed to automatically fill out meta data. | |
# add 'social' to mkdocs.yml file under plugins | |
- run: pip install cffi pillow cairosvg | |
# Material extension now part of mkdocs | |
- run: pip install mkdocs-material-extensions | |
# add mkdocs-redirects | |
# zoom images | |
- name: Install mkdocs-redirects | |
run: pip install mkdocs-redirects | |
# add lightbox | |
# zoom images | |
- name: Install MkDocs Light Box | |
run: pip install mkdocs-glightbox | |
# add multirepo to support pulling docs from other repos | |
- name: Install multirepo | |
run: pip install mkdocs-multirepo-plugin | |
# add include support for markdown | |
- name: Install include-markdown | |
run: pip install mkdocs-include-markdown-plugin | |
- run: pip install mkdocs | |
- run: pip install mkdocs-material | |
# enable when there is an Client Library dev branch | |
# - name: Extract branch name | |
# shell: bash | |
# run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
# id: extract_branch | |
###### checkout client library files - latest version | |
- name: Checkout Client Library | |
uses: actions/checkout@v3 | |
with: | |
repository: 'quixio/quix-streams' | |
ref: 'main' # when a dev branch exists we can get the dev content | |
#ref: '{{ steps.extract_branch.outputs.branch }}' | |
path: 'quix-streams' | |
### | |
# clone the library repo | |
- name: Checkout Samples | |
uses: actions/checkout@v3 | |
with: | |
repository: 'quixio/quix-samples' | |
ref: 'main' # when a dev branch exists we can get the dev content | |
#ref: '{{ steps.extract_branch.outputs.branch }}' | |
path: 'samples' | |
# use our own GitHub Action to bring in library readme files | |
- name: Quix Samples readme.md importer | |
uses: quixio/LibraryToMKDocsReadmeMergeAction@v2.17 | |
id: readme_importer | |
with: | |
LIBRARY_REPO_PATH: "samples" | |
DOCS_PATH: "" | |
REPLACEMENT_PLACEHOLDER: "#ConnectorsGetInsertedHere" | |
CONNECTORS_TAG: "Connectors" | |
NAV_INDENT_SPACES: "6" | |
CONNECTORS_TITLE_REPLACEMENT: "[//]: <> (#connectors_tile_replacement)" | |
# for debugging.. | |
# crawl the files, print the contents of specific files | |
- name: Crawl and print file hierarchy | |
run: | | |
print_files() { | |
local indent="$1" | |
shift | |
# specify the filenames you want to print | |
local filenames=("index.html" "index.md" "mkdocs.yml") | |
for path; do | |
local filename=$(basename "$path") | |
# check if filename is in filenames | |
if [[ " ${filenames[@]} " =~ " ${filename} " ]]; then | |
echo "$filename found at $path. Contents:" | |
cat "$path" | |
fi | |
if [ -d "$path" ]; then | |
print_files " $indent" "$path"/* | |
fi | |
done | |
} | |
print_files "" * | |
- name: Output Importer Logs | |
run: | | |
for i in ${{ steps.readme_importer.outputs.logs }}; do | |
echo $i | |
done | |
- name: Build MkDocs Site | |
run: mkdocs build --no-directory-urls | |
env: | |
AccessToken: ${{ secrets.QUIX_STREAMS_ACCESS_TOKEN }} | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Create container in Azure blob storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az login --service-principal -u 172103f9-7886-4f00-a49e-621461d234e1 -p ${{ secrets.DOCSBOT_SECRET }} --tenant 07dc27cd-da6f-4de6-b83d-c4eed0a10602 | |
az storage container create --name ${{ env.Deployment_Dir }} --public-access container --account-name quixdocsdev --auth-mode key | |
- name: Upload to blob storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az login --service-principal -u 172103f9-7886-4f00-a49e-621461d234e1 -p ${{ secrets.DOCSBOT_SECRET }} --tenant 07dc27cd-da6f-4de6-b83d-c4eed0a10602 | |
az storage blob upload-batch --overwrite true --account-name quixdocsdev --auth-mode key -d '${{ env.Deployment_Dir }}' -s site | |
# Azure logout | |
- name: logout | |
run: | | |
az logout | |
if: always() | |
- name: Echo Site URL | |
run: echo "Docs preview site available at https://quixdocsdev.blob.core.windows.net/${{ env.Deployment_Dir }}/index.html" | |
- name: Comment Site URL | |
uses: mshick/add-pr-comment@v2 | |
if: always() | |
with: | |
message: | | |
Docs preview site available at https://quixdocsdev.blob.core.windows.net/${{ env.Deployment_Dir }}/index.html | |
message-failure: | | |
Build failed. URL was not updated. | |
- name: Send Slack notification | |
id: slack | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": ":rocket: A build just left the launch pad\nPreview site available at https://quixdocsdev.blob.core.windows.net/${{ env.Deployment_Dir }}/index.html" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |