Skip to content

improve formatting

improve formatting #24

name: Publish TFDocs
on:
release:
types: [published]
push:
branches:
- 'test/*'
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Lint
run: |
pip install ruff
ruff --output-format=github .
continue-on-error: true
- name: Run Tests
run: |
pip install pytest pytest-cov
pytest --cov=tfdocs
deploy:
if: "!startsWith(github.ref, 'refs/heads/test/')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Bump version
run: |
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
PLACEHOLDER='__version__ = "0.1.dev1"'
VERSION_FILE='src/tfdocs/version.py'
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
shell: bash
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}