Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update semantic-release to 8.x #81

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- uses: pre-commit/action@v3.0.0

# Make sure commit messages follow the conventional commits convention:
Expand All @@ -40,9 +40,8 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
# - "3.12-dev"
- "3.12"
os:
- ubuntu-latest
- windows-latest
Expand All @@ -67,26 +66,47 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

release:
runs-on: ubuntu-latest
environment: release
needs:
- test
- lint
- commitlint

runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}

# Do a dry run of PSR
- name: Test release
uses: python-semantic-release/python-semantic-release@v8.7.2
if: github.ref_name != 'main'
with:
root_options: --noop

# On main branch: actual PSR + upload to PyPI & GitHub
- name: Release
uses: relekang/python-semantic-release@v7.34.6
uses: python-semantic-release/python-semantic-release@v8.7.2
id: release
if: github.ref_name == 'main'
with:
root_options: -vv
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
- name: Test release
uses: relekang/python-semantic-release@v7.34.6
if: github.ref_name != 'main'

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
additional_options: --noop
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- id: poetry-check
args: ["--lock"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
rev: v3.1.0
hooks:
- id: prettier
args: ["--tab-width", "2"]
Expand Down
46 changes: 2 additions & 44 deletions poetry.lock

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

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packages = [
"Changelog" = "https://github.com/chemelli74/aiocomelit/blob/main/CHANGELOG.md"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.11"
aiohttp = "*"
colorlog = "*"
pint = "*"
Expand All @@ -33,8 +33,8 @@ pytest-cov = ">=3,<5"

[tool.semantic_release]
branch = "main"
version_toml = "pyproject.toml:tool.poetry.version"
version_variable = "src/aiocomelit/__init__.py:__version__"
version_toml = ["pyproject.toml:tool.poetry.version"]
version_variable = ["src/aiocomelit/__init__.py:__version__"]
build_command = "pip install poetry && poetry build"

[tool.pytest.ini_options]
Expand Down
17 changes: 17 additions & 0 deletions templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

{%- for version, release in context.history.released.items() %}

## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})

{%- for category, commits in release["elements"].items() %}
{# Category title: Breaking, Fix, Documentation #}
### {{ category | capitalize }}
{%- if category != "unknown" %}
{# List actual changes in the category #}
{%- for commit in commits %}
- {{ commit.descriptions[0] | capitalize }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{%- endfor %}{# for commit #}
{% endif %}
{%- endfor %}{# for category, commits #}
{%- endfor %}{# for version, release #}