| 1 |
name: Make a Beets 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.10" |
| 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@v5 |
| 21 |
- name: Install uv |
| 22 |
uses: astral-sh/[email protected] |
| 23 |
with: |
| 24 |
python-version: ${{ env.PYTHON_VERSION }} |
| 25 |
|
| 26 |
- name: Install Python tools |
| 27 |
run: uv tool install "poethepoet>=0.26,<0.47.0" |
| 28 |
|
| 29 |
- name: Install dependencies |
| 30 |
run: poe install --group release --group docs |
| 31 |
|
| 32 |
- name: Bump project version |
| 33 |
run: | |
| 34 |
poe bump "${{ env.NEW_VERSION }}" |
| 35 |
# make sure project version is updated in the lock file as well |
| 36 |
uv lock |
| 37 |
|
| 38 |
- uses: EndBug/add-and-commit@v9 |
| 39 |
id: commit_and_tag |
| 40 |
name: Commit the changes and create tag |
| 41 |
with: |
| 42 |
message: "Increment version to ${{ env.NEW_VERSION }}" |
| 43 |
tag: "${{ env.NEW_TAG }} --force" |
| 44 |
|
| 45 |
build: |
| 46 |
name: Get changelog and build the distribution package |
| 47 |
runs-on: ubuntu-latest |
| 48 |
needs: increment-version |
| 49 |
outputs: |
| 50 |
changelog: ${{ steps.generate_changelog.outputs.changelog }} |
| 51 |
steps: |
| 52 |
- uses: actions/checkout@v5 |
| 53 |
with: |
| 54 |
ref: ${{ env.NEW_TAG }} |
| 55 |
|
| 56 |
- name: Install uv |
| 57 |
uses: astral-sh/[email protected] |
| 58 |
with: |
| 59 |
python-version: ${{ env.PYTHON_VERSION }} |
| 60 |
|
| 61 |
- name: Install Python tools |
| 62 |
run: uv tool install "poethepoet>=0.26,<0.47.0" |
| 63 |
|
| 64 |
- name: Install dependencies |
| 65 |
run: poe install --group release --group docs |
| 66 |
|
| 67 |
- name: Install pandoc |
| 68 |
run: sudo apt update && sudo apt install pandoc -y |
| 69 |
|
| 70 |
- name: Obtain the changelog |
| 71 |
id: generate_changelog |
| 72 |
run: | |
| 73 |
poe docs |
| 74 |
{ |
| 75 |
echo 'changelog<<EOF' |
| 76 |
poe --quiet changelog |
| 77 |
echo EOF |
| 78 |
} >> "$GITHUB_OUTPUT" |
| 79 |
|
| 80 |
- name: Build a binary wheel and a source tarball |
| 81 |
run: poe build |
| 82 |
|
| 83 |
- name: Store the distribution packages |
| 84 |
uses: actions/upload-artifact@v4 |
| 85 |
with: |
| 86 |
name: python-package-distributions |
| 87 |
path: dist/ |
| 88 |
|
| 89 |
publish-to-pypi: |
| 90 |
name: Publish distribution 📦 to PyPI |
| 91 |
runs-on: ubuntu-latest |
| 92 |
needs: build |
| 93 |
environment: |
| 94 |
name: pypi |
| 95 |
url: https://pypi.org/p/beets |
| 96 |
permissions: |
| 97 |
id-token: write |
| 98 |
steps: |
| 99 |
- name: Download all the dists |
| 100 |
uses: actions/download-artifact@v5 |
| 101 |
with: |
| 102 |
name: python-package-distributions |
| 103 |
path: dist/ |
| 104 |
- name: Publish distribution 📦 to PyPI |
| 105 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 106 |
|
| 107 |
make-github-release: |
| 108 |
name: Create GitHub release |
| 109 |
runs-on: ubuntu-latest |
| 110 |
needs: [build, publish-to-pypi] |
| 111 |
env: |
| 112 |
CHANGELOG: ${{ needs.build.outputs.changelog }} |
| 113 |
steps: |
| 114 |
- name: Download all the dists |
| 115 |
uses: actions/download-artifact@v5 |
| 116 |
with: |
| 117 |
name: python-package-distributions |
| 118 |
path: dist/ |
| 119 |
|
| 120 |
- name: Create a GitHub release |
| 121 |
id: make_release |
| 122 |
uses: ncipollo/release-action@v1 |
| 123 |
with: |
| 124 |
tag: ${{ env.NEW_TAG }} |
| 125 |
name: Release ${{ env.NEW_TAG }} |
| 126 |
body: ${{ env.CHANGELOG }} |
| 127 |
artifacts: dist/* |
| 128 |
- name: Send release toot to Fosstodon |
| 129 |
uses: cbrgm/mastodon-github-action@v2 |
| 130 |
continue-on-error: true |
| 131 |
with: |
| 132 |
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} |
| 133 |
url: ${{ secrets.MASTODON_URL }} |
| 134 |
message: "Version ${{ env.NEW_TAG }} of beets has been released! Check out all of the new changes at ${{ steps.make_release.outputs.html_url }}" |