8 upgrade poetry to 161 #57
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
Quality: | |
runs-on: ubuntu-latest | |
environment: github-pages | |
permissions: | |
id-token: write | |
contents: write | |
pages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install Python Poetry | |
uses: abatilo/[email protected] | |
- name: Configure poetry | |
shell: bash | |
run: python -m poetry config virtualenvs.in-project true | |
- name: View poetry version | |
run: poetry --version | |
- name: Install dependencies | |
run: | | |
python -m poetry install | |
- name: Test | |
run: poetry run python3 -m unittest discover | |
- name: Install pdoc3 | |
run: pip install pdoc3 | |
- name: Generate documentation | |
run: poetry run pdoc --html kgforge --force | |
- name: Upload documentation to GitHub Pages | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./html/kgforge | |
- name: Deploy documentation to GitHub Pages | |
uses: actions/deploy-pages@v2 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
Release: | |
needs: Quality | |
if: | | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/main' && | |
!contains ( github.event.head_commit.message, 'chore(release)' ) | |
runs-on: ubuntu-latest | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install Python Poetry | |
uses: abatilo/[email protected] | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Check release status | |
id: release-status | |
env: | |
GH_TOKEN: ${{ secrets.KGFORGE_GIT_TOKEN }} | |
run: | | |
pip install python-semantic-release | |
if semantic-release --strict version | |
then | |
echo "Releasing new version." | |
else | |
echo "Skipping release steps." | |
fi | |
- if: steps.release-status.outputs.released == 'true' | |
name: Publish to TestPyPI | |
env: | |
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: | | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.test-pypi $TEST_PYPI_TOKEN | |
poetry build | |
poetry publish -r test-pypi -u __token__ | |
- if: steps.release-status.outputs.released == 'true' | |
name: Release to PyPI | |
id: pypi-release | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry build | |
poetry publish |