diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 00000000..d9d09d48 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,77 @@ +name: Publish docs to GitHub pages + +on: + create: + branches: + - 'docs/**' + push: + branches: + - 'docs/**' + paths: + - 'docs/**' + +jobs: + publish: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7] + package: [docs] + + steps: + - uses: actions/checkout@v2 + with: + # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. + # Set fetch-depth: 0 to fetch all history for all branches and tags. + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Set the current branch environment variable + working-directory: ${{ matrix.package }} + run: | + CURRENT_BRANCH_VAR=${GITHUB_REF#refs/heads/} + echo "Current branch: $CURRENT_BRANCH_VAR" + # Set CURRENT_BRANCH environment variable to the current branch name. + echo "::set-env name=CURRENT_BRANCH::$(echo $CURRENT_BRANCH_VAR)" + - name: Display all remote branches + working-directory: ${{ matrix.package }} + run: | + # Display all remote branches + git branch -r + - name: Set the latest docs branch environment variable + working-directory: ${{ matrix.package }} + run: | + # Get only docs branches, extract the "docs/x.y.z" part, sort them in descending order, and get the first one. + LATEST_DOCS_BRANCH_VAR=$(git branch -r | grep -e ".*\/*docs\/[0-9].[0-9].[0-9]" | sed -n "s/.*\/*\(docs\/[0-9].[0-9].[0-9]\).*/\1/p" | sort -r | head -n 1) + echo "Latest docs branch: $LATEST_DOCS_BRANCH_VAR" + # Set the LATEST_DOCS_BRANCH environment variable. + echo "::set-env name=LATEST_DOCS_BRANCH::$(echo $LATEST_DOCS_BRANCH_VAR)" + - name: Check that the current branch is the latest docs branch, fail otherwise + working-directory: ${{ matrix.package }} + run: | + if [ $CURRENT_BRANCH != $LATEST_DOCS_BRANCH ]; then + echo "The action is running on branch $CURRENT_BRANCH which is not the latest docs branch ($LATEST_DOCS_BRANCH)." + exit 1 + else + echo "The action is running on the latest docs branch." + fi + - name: Install Pipenv + uses: dschep/install-pipenv-action@v1 + - name: Install dependencies for building documenation + working-directory: ${{ matrix.package }} + run: | + pipenv install + - name: Build documentation + working-directory: ${{ matrix.package }} + run: | + pipenv run mkdocs build --clean + - name: Deploy the contents of docs/site to gh-pages 🚀 + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/site + commit_message: Deploy to gh-pages 🚀 + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" diff --git a/docs/Pipfile b/docs/Pipfile index aa02c1f8..dc5d7ae0 100644 --- a/docs/Pipfile +++ b/docs/Pipfile @@ -4,9 +4,12 @@ verify_ssl = true name = "pypi" [packages] -mkdocs = "*" -mkdocs-material = "*" -markdown-include = "*" -mkdocs-awesome-pages-plugin = "*" +mkdocs = "==0.17.5" +mkdocs-material = "==2.9.2" +markdown-include = "==0.5.1" +mkdocs-awesome-pages-plugin = "==1.2.0" + +[requires] +python_version = "3.7" [dev-packages] diff --git a/docs/Pipfile.lock b/docs/Pipfile.lock index 6b9f6840..d43add76 100644 --- a/docs/Pipfile.lock +++ b/docs/Pipfile.lock @@ -1,10 +1,12 @@ { "_meta": { "hash": { - "sha256": "6766a756dba28084af761664985b55708ca941615fe77db3cafce3ce8c65135d" + "sha256": "30e56bad0351cec79ac4bd9b489c99a5c10653529c78a75b52ecebbf22cf5b7c" }, "pipfile-spec": 6, - "requires": {}, + "requires": { + "python_version": "3.7" + }, "sources": [ { "name": "pypi", @@ -16,32 +18,38 @@ "default": { "click": { "hashes": [ - "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", - "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" + "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", + "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc" + ], + "version": "==7.1.2" + }, + "importlib-metadata": { + "hashes": [ + "sha256:0505dd08068cfec00f53a74a0ad927676d7757da81b7436a6eefe4c7cf75c545", + "sha256:15ec6c0fd909e893e3a08b3a7c76ecb149122fb14b7efe1199ddd4c7c57ea958" ], - "version": "==6.7" + "markers": "python_version < '3.8'", + "version": "==1.6.1" }, "jinja2": { "hashes": [ - "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", - "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" + "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", + "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035" ], - "version": "==2.10" + "version": "==2.11.2" }, "livereload": { "hashes": [ - "sha256:583179dc8d49b040a9da79bd33de59e160d2a8802b939e304eb359a4419f6498", - "sha256:dd4469a8f5a6833576e9f5433f1439c306de15dbbfeceabd32479b1123380fa5" + "sha256:d1eddcb5c5eb8d2ca1fa1f750e580da624c0f7fcb734aa5780dc81b7dcbd89be" ], - "markers": "python_version != '3.0.*' and python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*'", - "version": "==2.5.2" + "version": "==2.6.2" }, "markdown": { "hashes": [ - "sha256:9ba587db9daee7ec761cfc656272be6aabe2ed300fece21208e4aab2e457bc8f", - "sha256:a856869c7ff079ad84a3e19cd87a64998350c2b94e9e08e44270faef33400f81" + "sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17", + "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59" ], - "version": "==2.6.11" + "version": "==3.2.2" }, "markdown-include": { "hashes": [ @@ -52,9 +60,41 @@ }, "markupsafe": { "hashes": [ - "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be" ], - "version": "==1.0" + "version": "==1.1.1" }, "mkdocs": { "hashes": [ @@ -82,40 +122,40 @@ }, "pygments": { "hashes": [ - "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", - "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + "sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44", + "sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324" ], - "version": "==2.2.0" + "version": "==2.6.1" }, "pymdown-extensions": { "hashes": [ - "sha256:20f2ae1067ab850cab92fcf57487267a7fd1365a7b1e7c5394e1e0778455eec1", - "sha256:7d3fcbb4c5d70a78d1f4c2c7eef02dbe7e1ba08b06cb72e08b3d1027eb77458b" + "sha256:5bf93d1ccd8281948cd7c559eb363e59b179b5373478e8a7195cf4b78e3c11b6", + "sha256:8f415b21ee86d80bb2c3676f4478b274d0a8ccb13af672a4c86b9ffd22bd005c" ], - "version": "==4.12" + "version": "==7.1" }, "pyyaml": { "hashes": [ - "sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b", - "sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf", - "sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a", - "sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3", - "sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1", - "sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1", - "sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613", - "sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04", - "sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f", - "sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537", - "sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531" + "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", + "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76", + "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2", + "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648", + "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf", + "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f", + "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2", + "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee", + "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d", + "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c", + "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a" ], - "version": "==3.13" + "version": "==5.3.1" }, "six": { "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", + "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" ], - "version": "==1.11.0" + "version": "==1.15.0" }, "tornado": { "hashes": [ @@ -126,6 +166,13 @@ "sha256:b36298e9f63f18cad97378db2222c0e0ca6a55f6304e605515e05a25483ed51a" ], "version": "==4.5.3" + }, + "zipp": { + "hashes": [ + "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", + "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96" + ], + "version": "==3.1.0" } }, "develop": {} diff --git a/docs/readme.md b/docs/readme.md index d74a142a..ece74f2f 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -3,18 +3,14 @@ This is the Markdown-based documentation for the Virtualization SDK. ## Local Testing -Create a `virtualenv` using Python 3 and run `pipenv run mkdocs serve` +Install dependencies for building documentation and run `pipenv run mkdocs serve` ``` -$ virtualenv -p /usr/local/bin/python3 . -Running virtualenv with interpreter /usr/local/bin/python3 -Using base prefix '/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7' -New python executable in /Users/asarin/Documents/repos/virt-sdk-docs/env/bin/python3.7 -Also creating executable in /Users/asarin/Documents/repos/virt-sdk-docs/env/bin/python -Installing setuptools, pip, wheel... -done. - -$ source bin/activate +$ pipenv install +Installing dependencies from Pipfile.lock (cf5b7c)... + 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 16/16 — 00:00:02 +To activate this project's virtualenv, run pipenv shell. +Alternatively, run a command inside the virtualenv with pipenv run. $ pipenv run mkdocs serve INFO - Building documentation... @@ -89,6 +85,15 @@ This will generate the `site` directory which will contain all the gererated doc 5. Go to your individual virtualization-sdk repo's settings, scroll to the bottom and verify under the GitHub Pages section the `Source` is set to `gh-pages branch`. 6. Right above this will be a link explaining where your docs are published. +You can also utilize the GitHub workflow for publishing docs (`.github/workflows/publish-docs.yml`) associated with a pull request. +The workflow is present on the `develop` branch. Create a branch called `docs/x.y.z` off `develop` on your fork of the repository +to ensure that your docs branch triggers the workflow. If you have more than one `docs/x.y.z` branch in your fork, +you have to push your doc changes to the docs branch with the latest `x.y.z` version. Otherwise, the workflow won't run. +You also have to make sure to choose `gh-pages` branch on your fork as the [publishing source](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#choosing-a-publishing-source). +Once you push doc changes to the `docs/.x.y.z` branch, the docs site should be available under +`.github.io/virtualization-sdk` shortly after. You can see the status of publishing under +`https://github.com//virtualization-sdk/actions`. This is a fast way to give a preview of your +changes in a pull request. ## Workflow diagrams We create workflow diagrams using a tool called `draw.io` which allows us to import/export diagrams in html format. If you want to add a diagram or edit an existing one, simply create or import the html file in `docs/References/html` into `draw.io` and make your desired changes. When you are done, select your diagram and export it as a png file. You can think of the html files as source code, and the png files as build artifacts. After this step, you will be prompted to crop what was selected. You'll want this box checked to trim the whitespace around the diagram. After the diagrams are exported, check in the updated html file to `docs/References/html` and png file to `docs/References/images`.