Skip to content

Commit f21acad

Browse files
committed
ci: add conventional commit lint and release please
1 parent 2298677 commit f21acad

18 files changed

Lines changed: 365 additions & 279 deletions

File tree

.github/workflows/commitlint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Commitlint
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
8+
jobs:
9+
commitlint:
10+
name: Lint commit messages
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
16+
with:
17+
fetch-depth: 0
18+
persist-credentials: false
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
22+
with:
23+
version: "0.9.*"
24+
enable-cache: false
25+
26+
- name: Check commit messages
27+
env:
28+
EVENT_BEFORE: ${{ github.event.before }}
29+
EVENT_AFTER: ${{ github.event.after }}
30+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
31+
run: |
32+
BEFORE="$EVENT_BEFORE"
33+
AFTER="$EVENT_AFTER"
34+
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
35+
BEFORE="$(git merge-base "origin/$DEFAULT_BRANCH" "$AFTER")"
36+
fi
37+
uv run --with 'commitizen==4.13.9' --isolated \
38+
cz check --rev-range "$BEFORE..$AFTER"

.github/workflows/release.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,32 @@ name: Release
33
on:
44
push:
55
branches:
6-
- main
7-
- dev
8-
tags:
9-
- '*'
6+
- main
7+
release:
8+
types: [published]
9+
1010
env:
1111
LATEST_PY_VERSION: '3.14'
1212

1313
jobs:
14+
release-please:
15+
name: Release Please
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'push'
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
steps:
22+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
config-file: release-please-config.json
26+
manifest-file: .release-please-manifest.json
27+
1428
build:
1529
name: Build dist
1630
runs-on: ubuntu-latest
17-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
31+
if: github.event_name == 'release'
1832
permissions:
1933
contents: read
2034
steps:
@@ -25,34 +39,14 @@ jobs:
2539
- name: Install uv
2640
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2741
with:
28-
version: "0.9.*"
42+
version: "0.9.*"
2943
enable-cache: false
3044
python-version: ${{ env.LATEST_PY_VERSION }}
3145

3246
- name: Install dependencies
3347
run: |
3448
uv sync
3549
36-
- name: Set tag version
37-
id: tag
38-
run: |
39-
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
40-
41-
- name: Set module version
42-
id: module
43-
run: |
44-
echo "version=$(uv version --short)" >> $GITHUB_OUTPUT
45-
46-
- name: Check version match
47-
env:
48-
TAG_VERSION: ${{ steps.tag.outputs.version }}
49-
MODULE_VERSION: ${{ steps.module.outputs.version }}
50-
run: |
51-
if [ "$TAG_VERSION" != "$MODULE_VERSION" ]; then
52-
echo "Tag version ($TAG_VERSION) does not match module version ($MODULE_VERSION)"
53-
exit 1
54-
fi
55-
5650
- name: Build
5751
run: |
5852
scripts/build

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ repos:
3333
hooks:
3434
- id: zizmor
3535
args: [--min-severity, medium]
36+
37+
- repo: https://github.com/commitizen-tools/commitizen
38+
rev: v4.13.9
39+
hooks:
40+
- id: commitizen
41+
stages: [commit-msg]

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "2.0.0"
3+
}

deployment/aws/lambda/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /tmp
88
RUN dnf install -y gcc-c++ && dnf clean all
99

1010
RUN python -m pip install pip -U
11-
RUN python -m pip install "titiler-application==2.0.0" "mangum==0.19.0" "cftime" -t /asset --no-binary pydantic,xarray,numpy,pandas
11+
RUN python -m pip install "titiler-application==2.0.0" "mangum==0.19.0" "cftime" -t /asset --no-binary pydantic,xarray,numpy,pandas # x-release-please-version
1212

1313
# Reduce package size and remove useless files
1414
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done;

deployment/k8s/charts/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
2-
appVersion: 2.0.0
2+
appVersion: "2.0.0" # x-release-please-version
33
description: A dynamic Web Map tile server
44
name: titiler
55
version: 2.1.0

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,5 +273,8 @@ replace = 'titiler-application=={new_version}'
273273

274274
[[tool.bumpversion.files]]
275275
filename = "deployment/k8s/charts/Chart.yaml"
276-
search = 'appVersion: {current_version}'
277-
replace = 'appVersion: {new_version}'
276+
search = 'appVersion: "{current_version}" # x-release-please-version'
277+
replace = 'appVersion: "{new_version}" # x-release-please-version'
278+
279+
[tool.commitizen]
280+
name = "cz_conventional_commits"

release-please-config.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "python",
5+
"package-name": "titiler",
6+
"changelog-path": "CHANGES.md",
7+
"changelog-type": "github",
8+
"changelog-sections": [
9+
{ "type": "feat", "section": "Features", "hidden": false },
10+
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
11+
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
12+
{ "type": "revert", "section": "Reverts", "hidden": false },
13+
{ "type": "docs", "section": "Documentation", "hidden": false },
14+
{ "type": "refactor", "section": "Code Refactoring", "hidden": false },
15+
{ "type": "style", "section": "Styles", "hidden": true },
16+
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
17+
{ "type": "test", "section": "Tests", "hidden": true },
18+
{ "type": "build", "section": "Build System", "hidden": true },
19+
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
20+
],
21+
"pull-request-title-pattern": "chore: release ${version}",
22+
"bump-minor-pre-major": true,
23+
"bump-patch-for-minor-pre-major": false,
24+
"include-component-in-tag": false,
25+
"include-v-in-tag": false,
26+
"extra-files": [
27+
{
28+
"type": "toml",
29+
"path": "pyproject.toml",
30+
"jsonpath": "$.project.version"
31+
},
32+
{ "type": "generic", "path": "src/titiler/core/titiler/core/__init__.py" },
33+
{ "type": "generic", "path": "src/titiler/xarray/titiler/xarray/__init__.py" },
34+
{ "type": "generic", "path": "src/titiler/extensions/titiler/extensions/__init__.py" },
35+
{ "type": "generic", "path": "src/titiler/mosaic/titiler/mosaic/__init__.py" },
36+
{ "type": "generic", "path": "src/titiler/application/titiler/application/__init__.py" },
37+
{ "type": "generic", "path": "src/titiler/xarray/pyproject.toml" },
38+
{ "type": "generic", "path": "src/titiler/extensions/pyproject.toml" },
39+
{ "type": "generic", "path": "src/titiler/mosaic/pyproject.toml" },
40+
{ "type": "generic", "path": "src/titiler/application/pyproject.toml" },
41+
{ "type": "generic", "path": "deployment/aws/lambda/Dockerfile" },
42+
{ "type": "generic", "path": "deployment/k8s/charts/Chart.yaml" }
43+
]
44+
}
45+
}
46+
}

src/titiler/application/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ classifiers = [
3030
]
3131
dynamic = ["version"]
3232
dependencies = [
33-
"titiler-core[telemetry]==2.0.0",
34-
"titiler-xarray==2.0.0",
35-
"titiler-extensions[cogeo,stac]==2.0.0",
36-
"titiler-mosaic[mosaicjson]==2.0.0",
33+
"titiler-core[telemetry]==2.0.0", # x-release-please-version
34+
"titiler-xarray==2.0.0", # x-release-please-version
35+
"titiler-extensions[cogeo,stac]==2.0.0", # x-release-please-version
36+
"titiler-mosaic[mosaicjson]==2.0.0", # x-release-please-version
3737
"starlette-cramjam>=0.4,<0.6",
3838
"pydantic-settings~=2.0",
3939
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""titiler.application"""
22

3-
__version__ = "2.0.0"
3+
__version__ = "2.0.0" # x-release-please-version

0 commit comments

Comments
 (0)