v1.33.3 - June 12, 2024 #1
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
# This workflow will Rebuild emod-api Docs triggered when changes to rst, python or requirements.txt files are intended. | |
# The resulting documentation files get uploaded to a shared location accessible to the author of the changes. | |
# Resulting link is provided. | |
# Please note that we are running the build with a flag that treats the errors as warnings. | |
name: Rebuild And Preview emod-api docs | |
on: | |
push: | |
paths: | |
- '**.py' | |
- '**/*docs/**' | |
- '**/requirements.txt' | |
pull_request: | |
branches: | |
- dev-* | |
- release* | |
- master | |
jobs: | |
emod-api-docs-Preview: | |
env: | |
BLOB_SOURCE: 'docs' | |
BLOB_ENDPOINT: 'https://docspreviewopt2.blob.core.windows.net' | |
BLOB_FIXEDPATH: 'temp/${{github.repository}}' | |
BLOB_CONTAINERNAME: 'idm' | |
INDEX_HTML: 'docs/_build/html/index.html' | |
#--------------------------------------------------------------------- | |
runs-on: ubuntu-latest | |
steps: | |
- name: Repo Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
# Environment Setup | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
# emod-api package setup | |
- name: Install emod-api requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple | |
- name: Install the emod-api package | |
run: | | |
pip install -e . --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple | |
# docs | |
- name: Install documentation build requirements | |
run: | | |
pip install -r docs/requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple | |
- name: Build docs - html - no break | |
id: build-docs | |
working-directory: 'docs' | |
run: | | |
make clean | |
make htmlnobreak | |
# # On Failure: STEP REMOVED - we will generate the links despite the results of the build. | |
# - name: If the build step failed | |
# if: ${{ failure() && steps.build-docs.conclusion == 'failure' }} | |
# run: | | |
# echo "Your build has failed, no link will be generated" | |
# echo "LINK_URL='No link has been generated'" >> $GITHUB_ENV | |
# echo "BLOB_MESSAGE='Only docs folder files were moved to the Storage Account'" >> $GITHUB_ENV | |
# On Success ------------------------------------------- | |
- name: Get current date | |
id: date | |
run: | | |
echo "::set-output name=getdate::$(TZ='America/Los_Angeles' date +'%B %d %H:%M:%S')" | |
echo "THIS_RUN=$(TZ='America/Los_Angeles' date +'%B%d-%H%M%S')" >> $GITHUB_ENV | |
- name: Updating LINK to your DOCS | |
run: | | |
echo "Your Documents are ready!" | |
echo "BLOB_MESSAGE='The full Docs folder and resulting build were moved to the Storage Account. This is your link:'" >> $GITHUB_ENV | |
echo "DESTINATION_PATH=${BLOB_FIXEDPATH}/${{env.THIS_RUN}}" >> $GITHUB_ENV | |
echo "LINK_URL=${BLOB_ENDPOINT}/${BLOB_CONTAINERNAME}/${BLOB_FIXEDPATH}/${{env.THIS_RUN}}/${INDEX_HTML}" >> $GITHUB_ENV | |
- name: Your LINK | |
run: | | |
echo "${{ env.LINK_URL }}" | |
# UPLOAD TO AZURE | |
- name: Azure Blob Upload | |
if: always() | |
uses: LanceMcCarthy/[email protected] | |
with: | |
connection_string: ${{ secrets.CONNECTION_STRING }} | |
container_name: ${{env.BLOB_CONTAINERNAME}} | |
source_folder: ${{ env.BLOB_SOURCE }} | |
destination_folder: '${{ env.DESTINATION_PATH }}/docs' | |
clean_destination_folder: false | |
fail_if_source_empty: true | |
is_recursive: true | |
# Updates PR | |
- name: Updates PR | |
if: always() | |
uses: mshick/add-pr-comment@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PR_UPDATE_TOKEN_MMG }} | |
with: | |
message: | | |
${{ steps.date.outputs.getdate }} - Run Id: ${{github.run_id}} **[-> Link to documents preview](${{ env.LINK_URL }})** |