|
1 |
| -name: CI/CD |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: |
6 |
| - - master |
7 |
| - pull_request: |
8 |
| - workflow_dispatch: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Run Tests"] |
| 6 | + branches: [master] |
| 7 | + types: [completed] |
| 8 | + |
| 9 | +permissions: |
| 10 | + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |
| 11 | + contents: write # needed for github actions bot to write to repo |
| 12 | + pull-requests: write |
9 | 13 |
|
10 | 14 | jobs:
|
11 |
| - test: |
12 |
| - name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} |
13 |
| - strategy: |
14 |
| - matrix: |
15 |
| - os: [ubuntu-latest] |
16 |
| - python-version: [3.9, '3.10', '3.11', '3.12'] |
17 |
| - runs-on: ${{ matrix.os }} |
| 15 | + publish: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 18 | + name: "Bump version, create changelog and publish" |
| 19 | + environment: |
| 20 | + name: pypi |
| 21 | + url: https://pypi.org/p/postgrest |
18 | 22 | steps:
|
19 |
| - - name: Clone Repository |
20 |
| - uses: actions/checkout@v4 |
21 |
| - - name: Set up Python ${{ matrix.python-version }} |
22 |
| - uses: actions/setup-python@v5 |
23 |
| - with: |
24 |
| - python-version: ${{ matrix.python-version }} |
25 |
| - - name: Set up Poetry |
26 |
| - |
27 |
| - with: |
28 |
| - poetry-version: 1.7.1 |
29 |
| - - name: Run Tests |
30 |
| - run: make run_tests |
31 |
| - - name: Upload Coverage |
32 |
| - |
| 23 | + - name: Set up Python 3.11 |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: 3.11 |
| 27 | + |
| 28 | + - name: Set up Poetry |
| 29 | + uses: abatilo/actions-poetry@v3 |
| 30 | + with: |
| 31 | + poetry-version: 1.8.3 |
| 32 | + |
| 33 | + - uses: googleapis/release-please-action@v4 |
| 34 | + id: release |
| 35 | + with: |
| 36 | + target-branch: ${{ github.ref_name }} |
| 37 | + |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + |
| 42 | + - if: ${{ steps.release.outputs }} |
| 43 | + id: versions |
| 44 | + run: | |
| 45 | + set -ex |
| 46 | +
|
| 47 | + MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} |
| 48 | + RELEASE_VERSION="$MAIN_RELEASE_VERSION" |
| 49 | + RELEASE_NAME="v$RELEASE_VERSION" |
| 50 | + RELEASE_CREATED='${{ steps.release.outputs.release_created }}' |
| 51 | + PRS_CREATED='${{ steps.release.outputs.prs_created }}' |
| 52 | +
|
| 53 | + echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" |
| 54 | + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" |
| 55 | + echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}" |
| 56 | + echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}" |
| 57 | + echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}" |
| 58 | +
|
| 59 | + - name: Install dependencies |
| 60 | + run: poetry install |
| 61 | + |
| 62 | + - name: Build package distribution directory |
| 63 | + id: build_dist |
| 64 | + run: poetry build |
| 65 | + |
| 66 | + - name: Publish package distributions to PyPI |
| 67 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments