-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjustfile
49 lines (34 loc) · 1.11 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set dotenv-load
version := `cat .version`
install:
poetry install
dev:
poetry run python3 main.py
run:
poetry run gunicorn -b 127.0.0.1:8000 main:app -k uvicorn.workers.UvicornWorker --workers 1
docker:
docker run --env-file .env docker.io/hfjn/ch_exporter:23.11.03
build:
docker build -t hfjn/ch_exporter:{{version}} -t hfjn/ch_exporter:latest .
push:
docker push hfjn/ch_exporter:{{version}}
docker push hfjn/ch_exporter:latest
_bump_version:
#! /usr/bin/env python3
import datetime
from pathlib import Path
curr_version = "{{ version }}"
curr_date = datetime.datetime.now().strftime("%y.%m")
if curr_date > curr_version:
curr_version = curr_date + ".01"
else:
left, right = curr_version.rsplit('.', 1)
curr_version = left + f".{(int(right) + 1):02}"
Path(".version").write_text(curr_version)
pyproject = []
for line in Path("pyproject.toml").read_text().splitlines():
if line.startswith("version = "):
pyproject.append(f'version = "{curr_version}"')
else:
pyproject.append(line)
Path("pyproject.toml").write_text("\n".join(pyproject))