Skip to content

Commit

Permalink
Improve Release Action (#89)
Browse files Browse the repository at this point in the history
This streamlines the release action a bit and adds a test to ensure the
plugin version matches in all places.
  • Loading branch information
gtronset committed May 14, 2023
1 parent 704ed78 commit cc82912
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:

env:
PYTHON_VERSION: 3.11
POETRY_VERSION: 1.3.1
POETRY_VERSION: 1.4.2

jobs:

Expand Down Expand Up @@ -44,10 +42,10 @@ jobs:

- name: Tag Name
id: tag-name
env:
TAG_REF: ${{ github.event.push.ref }}
run: |
echo name=${TAG_REF#refs/tags/} >> $GITHUB_OUTPUT
uses: SebRollen/toml-action@v1.0.2
with:
file: 'pyproject.toml'
field: 'tool.poetry.version'

- name: Check Version
id: check-version
Expand All @@ -59,7 +57,7 @@ jobs:
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ steps.tag-name.outputs.name }}"
tag: "v${{ steps.tag-name.outputs.value }}"
draft: false
generateReleaseNotes: true
prerelease: steps.check-version.outputs.prerelease == 'true'
Expand Down
22 changes: 17 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pytest = { version = "^7.1.3", python = "^3.7" }
mock = "^5.0.0"
mypy = { version = ">=0.991,<1.4", python = ">=3.7" }
reflink = "^0.2.1"
toml = "^0.10.2"

[build-system]
requires = ["poetry-core"]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ mypy>=0.991
pylint>=2.15.9
pytest>=7.1.3
reflink>=0.2.1
toml>=0.10.2
tox>=3.25.1
32 changes: 32 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Tests that the version specified for the plugin matches the value in pyproject.
"""

import toml # type: ignore # pylint: disable=import-error

import beetsplug
from tests.helper import FiletoteTestCase


class FiletoteVersionTest(FiletoteTestCase):
"""
Tests that the version specified for the plugin matches the value in
pyproject.
"""

def setUp(self, audible_plugin: bool = False) -> None:
"""Provides shared setup for tests."""
super().setUp()

def test_version_matches(self) -> None:
"""Ensure that the Filetote version is properly reflected in the right
areas."""

plugin_version = beetsplug.__version__

with open("./pyproject.toml", "r", encoding="utf-8") as pyproject_file:
data = toml.load(pyproject_file)

toml_version = data["tool"]["poetry"]["version"]

self.assertions.assertEqual(plugin_version, toml_version)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ deps =
beets-audible
mediafile
reflink
toml
commands =
{envpython} -m pytest tests

0 comments on commit cc82912

Please sign in to comment.