oops - bring back init and version #31
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: ci | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['*'] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| # run only on semantic version tag | |
| release: | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.') | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # GITHUB_ENV operates like a .env file | |
| - name: extract version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| CLEAN_VERSION=${VERSION#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
| pypi: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| pip install setuptools wheel twine build | |
| - name: publish | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: make release |