Skip to content

Commit 2ad8250

Browse files
committed
Merge branch 'main' into custom-templates
2 parents 50b84c7 + 789d791 commit 2ad8250

File tree

10 files changed

+159
-99
lines changed

10 files changed

+159
-99
lines changed

.ci/__init__.py

Whitespace-only changes.

.ci/patch_toml_version.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

.ci/update_build_version.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.35.1"
3+
}
File renamed without changes.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# ------------------------------------------------------------------------------
5+
# This script determines the version numbers used in builds and releases.
6+
#
7+
# It sets three environment variables:
8+
# - PKG_VER → The package version (semantic version).
9+
# - BUILD_VER → The build identifier (may include build number).
10+
# - PYPI_VER → A PyPI-compatible version string for publishing.
11+
#
12+
# Behavior:
13+
# - On a tagged commit (e.g. "v1.2.3"), it uses that tag as the version.
14+
# - On an untagged commit, it generates a "next dev version" by:
15+
# • Taking the latest tag (default v0.0.0 if none).
16+
# • Incrementing the minor version.
17+
# • Appending "+<run number>".
18+
# - PYPI_VER is derived from BUILD_VER by replacing "+" with ".dev".
19+
#
20+
# This ensures that:
21+
# - Release builds (tags) get clean versions like "1.2.3".
22+
# - Development builds get versions like "1.3.0+45" (PyPI: "1.3.0.dev45").
23+
# ------------------------------------------------------------------------------
24+
25+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
26+
# -------------------------------------------------------------
27+
# Case 1: This build is triggered by a Git tag
28+
# -------------------------------------------------------------
29+
# Extract the tag name (strip "refs/tags/")
30+
tag="${GITHUB_REF#refs/tags/}"
31+
# Remove leading "v" if present (e.g. "v1.2.3" → "1.2.3")
32+
export PKG_VER="${tag#v}"
33+
# For tagged releases, BUILD_VER is the same as PKG_VER
34+
export BUILD_VER="$PKG_VER"
35+
else
36+
# -------------------------------------------------------------
37+
# Case 2: This is not a tagged build (e.g. main branch commit)
38+
# -------------------------------------------------------------
39+
# Get the latest tag, or fall back to "v0.0.0" if none exist
40+
cv=$(git describe --abbrev=0 2>/dev/null || echo "v0.0.0")
41+
# Remove leading "v" if present
42+
cv=${cv#v}
43+
44+
# Split into major/minor components
45+
major=$(echo "$cv" | cut -d. -f1)
46+
minor=$(echo "$cv" | cut -d. -f2)
47+
48+
# Increment the minor version (e.g. "1.2" → "1.3")
49+
minor=$((minor + 1))
50+
51+
# Construct the package version: <major>.<minor>.0
52+
export PKG_VER="${major}.${minor}.0"
53+
54+
# Append the GitHub Actions run number for uniqueness
55+
export BUILD_VER="${PKG_VER}+$((GITHUB_RUN_NUMBER + 500))"
56+
fi
57+
58+
# -------------------------------------------------------------
59+
# Derive PyPI-compatible version
60+
# PyPI does not accept "+" in versions, so replace with ".dev"
61+
# Example: "1.3.0+45" → "1.3.0.dev45"
62+
# -------------------------------------------------------------
63+
export PYPI_VER="${BUILD_VER/+/.dev}"
64+
65+
# Print values for debugging in logs
66+
echo "PKG_VER=$PKG_VER"
67+
echo "BUILD_VER=$BUILD_VER"
68+
echo "PYPI_VER=$PYPI_VER"
69+
70+
# Export values as environment variables
71+
echo "PKG_VER=$PKG_VER" >> $GITHUB_ENV
72+
echo "BUILD_VER=$BUILD_VER" >> $GITHUB_ENV
73+
echo "PYPI_VER=$PYPI_VER" >> $GITHUB_ENV

.github/workflows/docs.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ permissions:
2424
contents: write # Required to push to the gh-pages branch
2525

2626
env:
27-
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Token used by mkdocs for pushing
28-
UV_SYSTEM_PYTHON: 1 # Use system Python interpreter with uv
27+
GH_TOKEN: ${{ secrets.GH_TOKEN }} # used by mkdocs for publishing
2928

3029
jobs:
3130
deploy:
@@ -36,23 +35,14 @@ jobs:
3635
- name: Checkout repository
3736
uses: actions/checkout@v4
3837

38+
- name: Setup uv
39+
uses: astral-sh/setup-uv@v6
40+
3941
- name: Configure Git for mkdocs
4042
run: |
4143
git config user.name github-actions[bot]
4244
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
4345
44-
- name: Install uv
45-
uses: astral-sh/setup-uv@v6
46-
47-
- name: Set up Python
48-
uses: actions/setup-python@v5
49-
with:
50-
python-version-file: "pyproject.toml" # Match Python version with project config
51-
52-
- name: Install dependencies
53-
run: |
54-
uv pip install -e .
55-
uv pip install --group docs --group lint
56-
5746
- name: Deploy to GitHub Pages
58-
run: uv run mkdocs gh-deploy --force
47+
run: |
48+
uv run --group docs --group lint mkdocs gh-deploy --force -v

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build & Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- '**' # match all branches
7+
tags:
8+
- '*' # match all tags
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
build:
18+
name: Publish flet-charts package
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0 # fetch all history
26+
fetch-tags: true # ensure tags are available
27+
28+
- name: Setup uv
29+
uses: astral-sh/setup-uv@v6
30+
31+
- name: Patch versions
32+
run: |
33+
source .github/scripts/update_build_version.sh
34+
uv version $PYPI_VER
35+
uv run .github/scripts/patch_pubspec_version.py src/flutter/*/pubspec.yaml $PKG_VER
36+
37+
- name: Setup Flutter
38+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
39+
with:
40+
path: '.fvmrc'
41+
cache: true
42+
43+
- name: Analyze Flutter package
44+
working-directory: src/flutter/flet_charts
45+
run: |
46+
dart pub get
47+
dart analyze
48+
49+
- name: Build Python package
50+
run: uv build
51+
52+
- name: Upload build artifacts
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: dist
56+
path: dist/*.whl
57+
58+
- name: Filter publish-relevant changes
59+
uses: dorny/paths-filter@v3
60+
id: changes
61+
with:
62+
filters: |
63+
publish:
64+
- 'src/**'
65+
- 'pyproject.toml'
66+
- 'README.md'
67+
68+
- name: Publish Python package
69+
if: steps.changes.outputs.publish == 'true' && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
70+
run: uv publish

appveyor.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test = [
2424
"pytest >=7.2.0",
2525
]
2626
lint = [
27-
"ruff >=0.11.7",
27+
"ruff >=0.13.1",
2828
]
2929
dev = [
3030
"pre-commit >=4.2.0",
@@ -36,14 +36,14 @@ docs-coverage = [
3636
]
3737
docs = [
3838
"mkdocs >=1.6.1",
39-
"mkdocs-material >=9.6.15",
40-
"mkdocstrings-python >=1.16.12",
41-
"mkdocstrings-python-xref >=1.16.3",
39+
"mkdocs-material >=9.6.20",
40+
"mkdocstrings-python >=1.18.2",
41+
"mkdocstrings-python-xref >=1.16.4",
4242
"mike >=2.1.3",
43-
"markdown >=3.6",
44-
"pymdown-extensions >=10.16",
43+
"markdown >=3.9",
44+
"pymdown-extensions >=10.16.1",
4545
"mkdocs-exclude >=1.0.2",
46-
"mkdocs-glightbox >=0.4.0",
46+
"mkdocs-glightbox >=0.5.1",
4747
"mkdocs-open-in-new-tab >=1.0.8",
4848
"mkdocs-section-index >=0.3.10",
4949
"griffe-modernized-annotations >=1.0.8",

0 commit comments

Comments
 (0)