| 1 | name: Make a release |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | inputs: |
| 6 | version: |
| 7 | description: 'Version of the new release, just as a number with no prepended "v"' |
| 8 | required: true |
| 9 | |
| 10 | env: |
| 11 | PYTHON_VERSION: 3.9 |
| 12 | NEW_VERSION: ${{ inputs.version }} |
| 13 | NEW_TAG: v${{ inputs.version }} |
| 14 | |
| 15 | jobs: |
| 16 | increment-version: |
| 17 | name: Bump version, commit and create tag |
| 18 | runs-on: ubuntu-latest |
| 19 | steps: |
| 20 | - uses: actions/checkout@v4 |
| 21 | - name: Install Python tools |
| 22 | uses: BrandonLWhite/[email protected] |
| 23 | - uses: actions/setup-python@v5 |
| 24 | with: |
| 25 | python-version: ${{ env.PYTHON_VERSION }} |
| 26 | cache: poetry |
| 27 | |
| 28 | - name: Bump project version |
| 29 | run: poetry version "${{ env.NEW_VERSION }}" |
| 30 | |
| 31 | - uses: EndBug/add-and-commit@v9 |
| 32 | id: commit_and_tag |
| 33 | name: Commit the changes and create tag |
| 34 | with: |
| 35 | message: "Increment version to ${{ env.NEW_VERSION }}" |
| 36 | tag: "${{ env.NEW_TAG }} --force" |
| 37 | |
| 38 | build: |
| 39 | name: Build the distribution package |
| 40 | runs-on: ubuntu-latest |
| 41 | needs: increment-version |
| 42 | steps: |
| 43 | - uses: actions/checkout@v4 |
| 44 | with: |
| 45 | ref: ${{ env.NEW_TAG }} |
| 46 | |
| 47 | - name: Install Python tools |
| 48 | uses: BrandonLWhite/[email protected] |
| 49 | - uses: actions/setup-python@v5 |
| 50 | with: |
| 51 | python-version: ${{ env.PYTHON_VERSION }} |
| 52 | cache: poetry |
| 53 | |
| 54 | - name: Build a binary wheel and a source tarball |
| 55 | run: poetry build |
| 56 | |
| 57 | - name: Store the package |
| 58 | uses: actions/upload-artifact@v4 |
| 59 | with: |
| 60 | name: python-package-distributions |
| 61 | path: dist/ |
| 62 | |
| 63 | publish-to-pypi: |
| 64 | name: Publish distribution 📦 to PyPI |
| 65 | runs-on: ubuntu-latest |
| 66 | needs: build |
| 67 | environment: |
| 68 | name: pypi |
| 69 | url: https://pypi.org/p/audioread |
| 70 | permissions: |
| 71 | id-token: write |
| 72 | steps: |
| 73 | - name: Download all the dists |
| 74 | uses: actions/download-artifact@v4 |
| 75 | with: |
| 76 | name: python-package-distributions |
| 77 | path: dist/ |
| 78 | - name: Publish distribution 📦 to PyPI |
| 79 | uses: pypa/gh-action-pypi-publish@release/v1 |