fix(setup): added pyprojectoml to setup the pkg #102
This file contains hidden or 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: Publish | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Run Test | |
| run: | | |
| pytest tests/ | |
| publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Python Semantic Release | |
| id: psr | |
| uses: python-semantic-release/python-semantic-release@v10 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| pypi_token: ${{ secrets.PYPI_TOKEN }} | |
| - name: Set up Python | |
| if: steps.psr.outputs.released == 'true' | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Sync version in botok/vars.py to release tag | |
| if: steps.psr.outputs.released == 'true' | |
| run: | | |
| set -euo pipefail | |
| git fetch --tags --force | |
| TAG="${{ steps.psr.outputs.tag }}" | |
| if [ -z "${TAG}" ]; then | |
| TAG="$(git describe --tags --abbrev=0)" | |
| fi | |
| VERSION="${TAG#v}" | |
| echo "Using version: ${VERSION}" | |
| sed -i -E "s/^(__version__\s*=\s*\").*(\")/\1${VERSION}\2/" botok/vars.py | |
| grep -n "__version__" botok/vars.py | |
| - name: Build package | |
| if: steps.psr.outputs.released == 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| python -m build | |
| - name: Publish package to PyPI | |
| if: steps.psr.outputs.released == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_TOKEN }} |