|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + candidate: |
| 7 | + description: 'If true, this creates a release candidate.' |
| 8 | + required: true |
| 9 | + type: boolean |
| 10 | + default: true |
| 11 | + test_pypi: |
| 12 | + description: 'If true, this will push to the test pypi instead of regular.' |
| 13 | + type: boolean |
| 14 | + default: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + release: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: '3.13' |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + python -m pip install .[dev] |
| 30 | +
|
| 31 | + - name: Configure Git user |
| 32 | + run: | |
| 33 | + git config user.name "SDV Team" |
| 34 | + git config user.email "[email protected]" |
| 35 | + git remote set-url origin https://x-access-token:${{ secrets.GH_ACCESS_TOKEN }}@github.com/${{ github.repository }} |
| 36 | +
|
| 37 | + - name: Merge main to stable and push tags |
| 38 | + if: ${{ !inputs.candidate }} |
| 39 | + run: | |
| 40 | + make check-release |
| 41 | + make git-merge-main-stable |
| 42 | + make bumpversion-release |
| 43 | + make git-push-tags-stable |
| 44 | +
|
| 45 | + - name: Create wheel |
| 46 | + run: | |
| 47 | + make check-main |
| 48 | + make dist |
| 49 | +
|
| 50 | + - name: Publish a Python distribution to PyPI |
| 51 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 52 | + with: |
| 53 | + password: ${{ inputs.test_pypi && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }} |
| 54 | + repository-url: ${{ inputs.test_pypi && 'https://test.pypi.org/legacy/' || 'https://pypi.org' }} |
| 55 | + |
| 56 | + - name: Bump to next candidate |
| 57 | + if: ${{ inputs.candidate }} |
| 58 | + run: | |
| 59 | + make bumpversion-candidate |
| 60 | + make git-push |
| 61 | + |
| 62 | + - name: Merge to main and bump to next patch |
| 63 | + if: ${{ !inputs.candidate }} |
| 64 | + run: | |
| 65 | + make git-merge-stable-main |
| 66 | + make bumpversion-patch |
| 67 | + make git-push |
0 commit comments