chore(release): 🚀 start tracking version, starting at 0.1.0

This commit is contained in:
m5ka 2024-04-11 18:34:03 +01:00
parent f0c7af3527
commit 7728f2623b
9 changed files with 156 additions and 90 deletions

80
.circleci/config.yml Normal file
View file

@ -0,0 +1,80 @@
version: 2.1
orbs:
semantic-release: trustedshops-public/semantic-release@6.0.0
jobs:
lint:
docker:
- image: cimg/python:3.12.2
steps:
- checkout
- restore_cache:
key: venv-dev-{{ checksum "poetry.lock" }}
- run:
name: set up venv
command: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- run:
name: install dependencies
command: poetry install --with dev
- save_cache:
key: venv-dev-{{ checksum "poetry.lock" }}
paths:
- .venv
- run:
name: run linter
command: |
poetry run ruff check .
poetry run ruff format --check .
test:
docker:
- image: cimg/python:3.12.2
- image: cimg/postgres:14.0
environment:
POSTGRES_USER: moku
POSTGRES_DB: moku
steps:
- checkout
- restore_cache:
key: venv-test-{{ checksum "poetry.lock" }}
- run:
name: set up venv
command: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- run:
name: install dependencies
command: poetry install --with test
- save_cache:
key: venv-test-{{ checksum "poetry.lock" }}
paths:
- .venv
- run:
name: wait for postgres
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: check migrations
command: poetry run python manage.py makemigrations --check
environment:
DATABASE_URL: postgres://moku@localhost:5432/moku
- run:
name: run tests
command: poetry run pytest
environment:
DATABASE_URL: postgres://moku@localhost:5432/moku
workflows:
version: 2
main:
jobs:
- lint
- test
- semantic-release/with_existing_config:
name: semantic release
additional_packages: @google/semantic-release-replace-plugin
requires:
- lint
- test
filter:
branches:
only:
- main

View file

@ -1,36 +0,0 @@
name: lint
on:
pull_request:
branches:
- '*'
push:
branches:
- 'main'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.8.2'
- name: set up virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: cache virtual environment
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: install dependencies
run: poetry install --with dev
- name: check linter and formatter
run: |
poetry run ruff check .
poetry run ruff format --check .

View file

@ -1,52 +0,0 @@
name: test
on:
pull_request:
branches:
- '*'
push:
branches:
- 'main'
env:
DEBUG: true
DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres'
DJANGO_DEBUG_TOOLBAR: false
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- '5432:5432'
steps:
- uses: actions/checkout@v4
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.8.2'
- name: set up virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: cache virtual environment
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: install dependencies
run: poetry install --with test
- name: check migrations
run: poetry run python manage.py makemigrations --check
- name: run tests
run: poetry run pytest

63
.releaserc.json Normal file
View file

@ -0,0 +1,63 @@
{
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@google/semantic-release-replace-plugin",
{
"replacements": [
{
"files": [
"pyproject.toml"
],
"from": "version = \"[0-9.]+\"",
"to": "version = \"${nextRelease.version}\"",
"results": [
{
"file": "pyproject.toml",
"hasChanged": true
}
]
}
]
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"pyproject.toml"
],
"message": "chore(release): 🚀 bump version to ${nextRelease.version} [skip ci]\\n\\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"path": "semantic-release",
"name": "m5ka/moku.blog"
}
]
],
"tagFormat": "${version}"
}

View file

@ -1 +1,4 @@
from importlib.metadata import version
__version__ = version(__name__)
default_app_config = "moku.config.apps.MokuConfig" default_app_config = "moku.config.apps.MokuConfig"

View file

@ -470,6 +470,11 @@ footer nav ul {
column-gap: 1.2rem; column-gap: 1.2rem;
} }
footer nav ul li.version {
color: var(--charcoal);
font-size: 1.4rem;
}
footer nav ul li a { footer nav ul li a {
font-size: 1.4rem; font-size: 1.4rem;
color: var(--charcoal); color: var(--charcoal);

View file

@ -56,7 +56,8 @@
{% if request.user.is_authenticated %}<li><a href="{{ url('settings') }}">{% trans %}settings{% endtrans %}</a></li>{% endif %} {% if request.user.is_authenticated %}<li><a href="{{ url('settings') }}">{% trans %}settings{% endtrans %}</a></li>{% endif %}
<li><a href="{{ url('terms') }}">{% trans %}terms of use{% endtrans %}</a></li> <li><a href="{{ url('terms') }}">{% trans %}terms of use{% endtrans %}</a></li>
<li><a href="{{ url('privacy') }}">{% trans %}privacy policy{% endtrans %}</a></li> <li><a href="{{ url('privacy') }}">{% trans %}privacy policy{% endtrans %}</a></li>
<li><a href="https://ko-fi.com/mokublog" target="_blank" rel="noreferrer">{% trans %}donate{% endtrans %}❤️</a></li> <li><a href="https://ko-fi.com/mokublog" target="_blank" rel="noreferrer">{% trans %}donate{% endtrans %}</a></li>
<li class="version">v{{ site_version }}</li>
</ul> </ul>
</nav> </nav>
</footer> </footer>

View file

@ -3,6 +3,8 @@ import random
from django.conf import settings from django.conf import settings
from django.views import generic from django.views import generic
from moku import __version__ as site_version
class View(generic.TemplateView): class View(generic.TemplateView):
"""Defines a common set of data to be passed to the template context.""" """Defines a common set of data to be passed to the template context."""
@ -17,6 +19,7 @@ class View(generic.TemplateView):
["🍔", "🍕", "🍟", "🥪", "🥘", "🍰", "🍻", "🧁", "🍞", "🥯", "🥐"] ["🍔", "🍕", "🍟", "🥪", "🥘", "🍰", "🍻", "🧁", "🍞", "🥯", "🥐"]
), ),
"site_root_url": settings.SITE_ROOT_URL, "site_root_url": settings.SITE_ROOT_URL,
"site_version": site_version,
"page_title": self.page_title, "page_title": self.page_title,
} }

View file

@ -5,7 +5,6 @@ description = "a lightweight food blogging site"
authors = ["m5ka <m5ka@posteo.de>"] authors = ["m5ka <m5ka@posteo.de>"]
license = "BSD 2-Clause" license = "BSD 2-Clause"
readme = "README.md" readme = "README.md"
package-mode = false
[tool.poetry.dependencies] [tool.poetry.dependencies]
django = "^5.0.3" django = "^5.0.3"