Get pyproject version dynamically and deploy on main branch: #6
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
# .github/workflows/ci-cd.yml | |
--- | |
on: | |
- push | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pip install --upgrade pip | |
- run: pip install -e '.[test]' | |
- run: pytest -sxv | |
pypi-publish: | |
name: Upload release to PyPI | |
needs: | |
- test | |
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/nomad-tools | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pip install --upgrade build | |
- run: python -m build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |