Skip to content

Merge Dev->Main, Deploy GH-Pages #60

Merge Dev->Main, Deploy GH-Pages

Merge Dev->Main, Deploy GH-Pages #60

name: Merge Dev->Main, Deploy GH-Pages
on:
# Runs on pushes targeting the default branch
#push:
# branches: [$default-branch]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Check out main branch of Docs Prod repo
uses: actions/checkout@v3
with:
ref: main
# - name: Merge dev -> main
# uses: devmasx/merge-branch@master
# with:
# type: now
# from_branch: dev
# target_branch: main
# github_token: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Add Python Setup Tools
run: python -m pip install --upgrade pip setuptools wheel
# Needed when using more than one repo
# add 'monorepo' to mkdocs.yml file under plugins
- name: Install MKdocs Monorepo Plugin
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
# Install Material insiders theme
- name: Install Material insiders theme
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: pip install git+https://${{ env.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
- name: Install Mkdocs
run: pip install mkdocs
- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
####################################################
### COPY AND MASSAGE Client Library DOCS REPO README INTO DOCS
####################################################
# 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
- 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: 'client-library'
# copy client library readme to client library intro.md
- name: Copy and rename client library intro.md
shell: bash
run: cp client-library/README.md docs/client-library-intro.md
# copy client library images to client library intro.md
- name: Copy Client Library Quix image
shell: bash
run: cp client-library/images/quixstreams-banner.jpg docs/assets/quixstreams-banner.jpg
# copy client library images to docs/assets/client-library/
- name: Copy Client Library waveform image
shell: bash
run: cp -r client-library/images/. docs/assets/client-library/
# Change image URL in the copied file to new location
# sed -i 's/old-text/new-text/g' input.txt
- name: Update intro.md
shell: bash
run: "sed -i 's,https://github.com/quixio/.github/blob/main/profile,./assets,g' docs/client-library-intro.md"
# Change image paths from ./images to ./assets/client-library
- name: Update intro.md
shell: bash
run: "sed -i 's,./images,./assets/client-library/,g' docs/client-library-intro.md"
####################################################
### END
####################################################
####################################################
### IMPORT LIBRARY README.MD FILES INTO DOCS
####################################################
# clone the library repo
- name: Checkout Samples
uses: actions/checkout@v3
with:
repository: 'quixio/quix-samples'
ref: 'develop' # 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.13
id: readme_importer
with:
LIBRARY_REPO_PATH: "samples"
DOCS_PATH: ""
REPLACEMENT_PLACEHOLDER: "#ConnectorsGetInsertedHere"
README_DEST: "docs/library_readmes/connectors"
- name: Output Importer Logs
run: |
for i in ${{ steps.readme_importer.outputs.logs }}; do
echo $i
done
####################################################
### END OF IMPORT LIBRARY README.MD's
####################################################
- name: Build MkDocs Site
run: mkdocs build --no-directory-urls
env:
AccessToken: ${{ secrets.QUIX_STREAMS_ACCESS_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./site
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1