|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - created |
| 7 | + |
| 8 | +jobs: |
| 9 | + release-pypi: |
| 10 | + name: release-pypi |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Setup Poetry |
| 18 | + uses: snok/install-poetry@v1 |
| 19 | + with: |
| 20 | + virtualenvs-create: true |
| 21 | + virtualenvs-in-project: true |
| 22 | + |
| 23 | + - name: Load cached venv |
| 24 | + id: cached-poetry-dependencies |
| 25 | + uses: actions/cache@v3 |
| 26 | + with: |
| 27 | + path: .venv |
| 28 | + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 32 | + run: poetry install --no-interaction --no-root |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: poetry install --no-interaction |
| 36 | + |
| 37 | + - name: Run tests |
| 38 | + run: | |
| 39 | + source .venv/bin/activate |
| 40 | + pytest tests/ |
| 41 | +
|
| 42 | + - name: Make build |
| 43 | + run: make build |
| 44 | + |
| 45 | + - name: Upload to Pypi |
| 46 | + run: | |
| 47 | + pip install twine |
| 48 | + twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} dist/* |
| 49 | +
|
| 50 | + - name: Bump version |
| 51 | + run: | |
| 52 | + CURRENT_VERSION=$(cat pyproject.toml | grep '^version\s*=\s*' | awk '{print $NF}' | tr -d \") |
| 53 | + NEW_VERSION=$(poetry run versionbump --current ${CURRENT_VERSION} patch pyproject.toml) |
| 54 | +
|
| 55 | + - name: Create Pull Request |
| 56 | + uses: peter-evans/create-pull-request@v3 |
| 57 | + with: |
| 58 | + commit-message: Bump version |
| 59 | + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> |
| 60 | + signoff: false |
| 61 | + base: main |
| 62 | + branch: version-bump |
| 63 | + delete-branch: true |
| 64 | + title: "Update version in main branch" |
| 65 | + body: | |
| 66 | + Update report |
| 67 | + - Updated pyproject.toml with new version |
| 68 | + - Auto-generated by [create-pull-request][1] |
| 69 | +
|
| 70 | + [1]: https://github.com/peter-evans/create-pull-request |
| 71 | + labels: | |
| 72 | + automated pr |
| 73 | + assignees: ${{ github.actor }} |
| 74 | + team-reviewers: | |
| 75 | + owners |
| 76 | + maintainers |
| 77 | + draft: false |
0 commit comments