Merge pull request #105 from AllenNeuralDynamics/wip/update_docs_docs… #49
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: Tag and Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Extract version from the package | |
id: get_version | |
shell: bash | |
run: | | |
RELEASE_VERSION=$(python -c 'import parallax; print(parallax.__version__)') | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
echo "Extracted RELEASE_VERSION: $RELEASE_VERSION" | |
- name: Configure Git Account | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Hanna" | |
- name: Create Git tag | |
run: | | |
git tag -a ${{ env.RELEASE_VERSION }} -m "Release ${{ env.RELEASE_VERSION }}" | |
git push origin ${{ env.RELEASE_VERSION }} | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: Release ${{ env.RELEASE_VERSION }} | |
draft: false | |
prerelease: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine build | |
- name: Install project | |
run: pip install -e . | |
- name: Build package | |
run: | | |
python -m build | |
twine check dist/* | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.AIND_PYPI_TOKEN }} | |
# Job 2: Build Documentation for Pushes to Main | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
# Step 3: Install dependencies (including Sphinx) | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r docs/requirements.txt | |
# Step 4: Build the documentation | |
- name: Build Documentation | |
run: | | |
sphinx-build -b html docs/source docs/_build | |
# Fail the workflow if documentation build fails | |
continue-on-error: false |