-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# .github/workflows | ||
|
||
name: Automated Setup Generation | ||
|
||
# Workflow triggers | ||
on: | ||
workflow_dispatch: # Allows manual triggering of the workflow | ||
push: # Triggers the workflow on every push to the repository | ||
|
||
jobs: | ||
format-setup-customized: | ||
runs-on: ubuntu-latest # Specifies the virtual machine to use, in this case, the latest version of Ubuntu | ||
|
||
# Defines permissions for this job | ||
permissions: | ||
contents: write # Permissions to write to the repository | ||
|
||
steps: | ||
- uses: actions/checkout@v4 # Checks out the code from the repository | ||
|
||
# Step to update and prepare the documentation | ||
- name: Prepare and Update Documentation | ||
|
||
run: | | ||
# Verifica si setup.py existe, si no, lo crea | ||
if [ ! -f "setup.py" ]; then | ||
echo """import os | ||
from setuptools import setup | ||
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: | ||
README = readme.read() | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
setup( | ||
name=\"${{ vars.DOCS_MODULE }}-{{ vars.DOCS_SUBMODULE }}\", | ||
version='0.1', | ||
packages=[\"${{ vars.DOCS_MODULE }}-{{ vars.DOCS_SUBMODULE }}\"], | ||
author=\"${{ vars.DOCS_AUTHOR }}\", | ||
author_email=\"${{ vars.DOCS_EMAIL }}\", | ||
maintainer=\"${{ vars.DOCS_AUTHOR }}\", | ||
maintainer_email=\"${{ vars.DOCS_EMAIL }}\", | ||
download_url='', | ||
install_requires=[ | ||
], | ||
scripts=[ | ||
], | ||
include_package_data=True, | ||
license='Simplified BSD License', | ||
description=\"\", | ||
zip_safe=False, | ||
long_description=README, | ||
long_description_content_type='text/markdown', | ||
python_requires='>=3.7', | ||
#https://pypi.org/classifiers/ | ||
classifiers=[ | ||
], | ||
) | ||
""" >> setup.py | ||
fi | ||
# Commit all changed files back to the repository | ||
- uses: stefanzweifel/git-auto-commit-action@v5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# .github/workflows | ||
|
||
name: Automated Documentation and Code Formatting | ||
|
||
# Workflow triggers | ||
on: | ||
workflow_dispatch: # Allows manual triggering of the workflow | ||
push: # Triggers the workflow on every push to the repository | ||
|
||
jobs: | ||
format-sphinx-customized: | ||
runs-on: ubuntu-latest # Specifies the virtual machine to use, in this case, the latest version of Ubuntu | ||
|
||
# Defines permissions for this job | ||
permissions: | ||
contents: write # Permissions to write to the repository | ||
|
||
steps: | ||
- uses: actions/checkout@v4 # Checks out the code from the repository | ||
|
||
# Step to update and prepare the documentation | ||
- name: Prepare and Update Documentation | ||
|
||
run: | | ||
# Pulls necessary Docker images for documentation | ||
docker pull dunderlab/docs | ||
docker pull sphinxdoc/sphinx-latexpdf | ||
# Installs required Python packages | ||
pip install nbsphinx | ||
pip install dunderlab-docs | ||
# Sets up initial documentation if a 'docs' directory does not exist | ||
if [ ! -d "docs" ]; then | ||
dunderlab_docs quickstart '--project "${{ vars.DOCS_PROJECT_NAME }}" --author "${{ vars.DOCS_AUTHOR }}" --extensions nbsphinx,dunderlab.docs --no-batchfile --quiet --sep' | ||
fi | ||
# Generates API documentation and builds HTML and Latex PDF if SUBMODULE is set | ||
if [ -n "${{ vars.DOCS_SUBMODULE }}" ]; then | ||
dunderlab_docs apidoc "${{ vars.DOCS_MODULE }}" | ||
dunderlab_docs build html "${{ vars.DOCS_MODULE }}/${{ vars.DOCS_SUBMODULE }}" | ||
dunderlab_docs build latexpdf "${{ vars.DOCS_MODULE }}/${{ vars.DOCS_SUBMODULE }}" | ||
else | ||
dunderlab_docs apidoc "${{ vars.DOCS_MODULE }}" | ||
dunderlab_docs build html "${{ vars.DOCS_MODULE }}" | ||
dunderlab_docs build latexpdf "${{ vars.DOCS_MODULE }}" | ||
fi | ||
# Adds a configuration file for Read the Docs | ||
# Verifies if .readthedocs.yml exists, if not, creates it | ||
if [ ! -f ".readthedocs.yml" ]; then | ||
echo """# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
# Required | ||
version: 2 | ||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
install: | ||
- requirements: docs/requirements | ||
# Set the version of Python and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: \"3.11\" | ||
formats: | ||
- epub | ||
""" >> .readthedocs.yml | ||
fi | ||
# Commit all changed files back to the repository | ||
- uses: stefanzweifel/git-auto-commit-action@v5 |