1212 type : string
1313
1414jobs :
15- test :
16- uses : ./.github/workflows/test.yml
17-
18- build :
19- needs : test
15+ extract-version :
2016 runs-on : ubuntu-latest
21- container :
22- image : python:3.12-bookworm
17+ outputs :
18+ version : ${{ steps.version.outputs.version }}
19+ version_number : ${{ steps.version.outputs.version_number }}
20+ steps :
21+ - name : Extract version from tag
22+ id : version
23+ run : |
24+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
25+ VERSION=${{ inputs.tag }}
26+ else
27+ VERSION=${GITHUB_REF#refs/tags/}
28+ fi
29+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
30+ echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
31+
32+ linux-build :
33+ needs : [extract-version]
34+ strategy :
35+ fail-fast : false
36+ matrix :
37+ include :
38+ - os : ubuntu-latest
39+ container : python:3.12-bookworm
40+ platform : linux_x86_64
41+ arch : x86_64
42+ arch_label : x86_64
43+ - os : ubuntu-24.04-arm
44+ container : python:3.12-bookworm
45+ platform : linux_aarch64
46+ arch : arm64
47+ arch_label : arm64
48+ runs-on : ${{ matrix.os }}
49+ container : ${{ matrix.container }}
2350 env :
2451 UV_LINK_MODE : copy
2552 UV_CACHE_DIR : /github/home/.cache/uv
@@ -37,30 +64,20 @@ jobs:
3764 uses : actions/cache@v5
3865 with :
3966 path : /github/home/.cache/uv
40- key : uvcache-${{ runner.os }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
67+ key : uvcache-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
4168 restore-keys : |
42- uvcache-${{ runner.os }}-
43-
44- - name : Extract version from tag
45- id : version
46- run : |
47- if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
48- VERSION=${{ inputs.tag }}
49- else
50- VERSION=${GITHUB_REF#refs/tags/}
51- fi
52- echo "version=${VERSION}" >> $GITHUB_OUTPUT
53- echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
69+ uvcache-${{ runner.os }}-${{ matrix.arch_label }}-
5470
5571 - name : Add Debian sid repository
72+ if : matrix.container != null
5673 run : |
5774 echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list.d/sid.list
5875 echo 'Package: *\nPin: release a=sid\nPin-Priority: 100' > /etc/apt/preferences.d/sid
5976
60- - name : Install system dependencies
77+ - name : Install system dependencies (Linux)
78+ if : matrix.container != null
6179 run : |
6280 apt-get update
63- # Ensure /etc/os-release exists (required by some actions' OS detection).
6481 apt-get install -y base-files
6582 apt-get install -y build-essential pkg-config libbz2-dev
6683 apt-get install -y -t sid libmapnik-dev
@@ -77,44 +94,122 @@ jobs:
7794 - name : Upload build artifacts
7895 uses : actions/upload-artifact@v4
7996 with :
80- name : dist
97+ name : dist-${{ matrix.platform }}
8198 path : dist/
8299 retention-days : 7
83100
101+ # macos-build:
102+ # needs: [extract-version]
103+ # strategy:
104+ # fail-fast: false
105+ # matrix:
106+ # include:
107+ # - os: macos-15-intel
108+ # platform: macosx_10_9_x86_64
109+ # arch: x86_64
110+ # arch_label: x86_64
111+ # - os: macos-15
112+ # platform: macosx_15_0_arm64
113+ # arch: arm64
114+ # arch_label: arm64
115+ # runs-on: ${{ matrix.os }}
116+ # env:
117+ # UV_LINK_MODE: copy
118+ # UV_CACHE_DIR: /Users/runner/.cache/uv
119+ # permissions:
120+ # actions: write
121+ # contents: write
122+
123+ # steps:
124+ # - name: Checkout code
125+ # uses: actions/checkout@v6
126+ # with:
127+ # submodules: recursive
128+
129+ # - name: Cache uv downloads
130+ # uses: actions/cache@v5
131+ # with:
132+ # path: /Users/runner/.cache/uv
133+ # key: uvcache-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
134+ # restore-keys: |
135+ # uvcache-${{ runner.os }}-${{ matrix.arch_label }}-
136+
137+ # - name: Install system dependencies (macOS)
138+ # run: |
139+ # brew update
140+ # brew install mapnik
141+
142+ # - name: Install uv
143+ # uses: astral-sh/setup-uv@v7
144+ # with:
145+ # enable-cache: false
146+
147+ # - name: Build wheel and sdist
148+ # run: |
149+ # uv build --wheel --sdist
150+
151+ # - name: Upload build artifacts
152+ # uses: actions/upload-artifact@v4
153+ # with:
154+ # name: dist-${{ matrix.platform }}
155+ # path: dist/
156+ # retention-days: 7
157+
158+ release :
159+ needs :
160+ - extract-version
161+ - linux-build
162+ # - macos-build
163+ runs-on : ubuntu-latest
164+ permissions :
165+ contents : write
166+ if : github.event_name == 'push'
167+
168+ steps :
169+ - name : Download all artifacts
170+ uses : actions/download-artifact@v4
171+ with :
172+ path : dist-all
173+
174+ - name : Combine artifacts
175+ run : |
176+ mkdir -p dist
177+ find dist-all -name "*.whl" -exec cp {} dist/ \;
178+ find dist-all -name "*.tar.gz" -exec head -1 {} \; | head -1 | xargs -I {} find dist-all -name "{}" -exec cp {} dist/ \;
179+
84180 - name : Create GitHub Release
85181 uses : softprops/action-gh-release@v2
86- if : github.event_name == 'push'
87182 with :
88- tag_name : ${{ steps. version.outputs.version }}
89- name : Release ${{ steps. version.outputs.version }}
183+ tag_name : ${{ needs.extract- version.outputs.version }}
184+ name : Release ${{ needs.extract- version.outputs.version }}
90185 body : |
91- ## Python Mapnik ${{ steps. version.outputs.version_number }}
186+ ## Python Mapnik ${{ needs.extract- version.outputs.version_number }}
92187
93188 ### Installation
94189
95- Download the wheel file below and install:
190+ Download the wheel file for your platform and install:
96191 ```bash
97- pip install mapnik-${{ steps. version.outputs.version_number }}-*.whl
192+ pip install mapnik-${{ needs.extract- version.outputs.version_number }}-*.whl
98193 ```
99194
100- Or install directly from GitHub:
195+ Or install directly from GitHub (replace platform tag as needed) :
101196 ```bash
102- pip install https://github.com/${{ github.repository }}/releases/download/${{ steps. version.outputs.version }}/mapnik-${{ steps. version.outputs.version_number }}-cp312-cp312-linux_x86_64.whl
197+ pip install https://github.com/${{ github.repository }}/releases/download/${{ needs.extract- version.outputs.version }}/mapnik-${{ needs.extract- version.outputs.version_number }}-cp312-cp312-linux_x86_64.whl
103198 ```
104199
105200 Or install from source:
106201 ```bash
107- pip install git+https://github.com/${{ github.repository }}.git@${{ steps. version.outputs.version }}
202+ pip install git+https://github.com/${{ github.repository }}.git@${{ needs.extract- version.outputs.version }}
108203 ```
109204
110205 ### Requirements
111206
112- - Python >= 3.8
113- - Mapnik >= 4.0 .0
207+ - Python >= 3.12
208+ - Mapnik >= 4.2 .0
114209
115210 ### Changes
116211
117- See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ steps. version.outputs.version }}/CHANGELOG.md) for details.
212+ See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.extract- version.outputs.version }}/CHANGELOG.md) for details.
118213 files : |
119214 dist/*.whl
120215 dist/*.tar.gz
@@ -127,10 +222,16 @@ jobs:
127222 run : |
128223 echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
129224 echo "" >> $GITHUB_STEP_SUMMARY
130- echo "✅ Released version: **${{ steps. version.outputs.version }}**" >> $GITHUB_STEP_SUMMARY
225+ echo "✅ Released version: **${{ needs.extract- version.outputs.version }}**" >> $GITHUB_STEP_SUMMARY
131226 echo "" >> $GITHUB_STEP_SUMMARY
132227 echo "### Artifacts Built:" >> $GITHUB_STEP_SUMMARY
133228 ls -lh dist/ >> $GITHUB_STEP_SUMMARY
134229 echo "" >> $GITHUB_STEP_SUMMARY
230+ echo "### Supported Platforms:" >> $GITHUB_STEP_SUMMARY
231+ echo "- Linux x86_64: ✅" >> $GITHUB_STEP_SUMMARY
232+ echo "- Linux arm64: ✅" >> $GITHUB_STEP_SUMMARY
233+ # echo "- macOS x86_64: ✅" >> $GITHUB_STEP_SUMMARY
234+ # echo "- macOS arm64: ✅" >> $GITHUB_STEP_SUMMARY
235+ echo "" >> $GITHUB_STEP_SUMMARY
135236 echo "### Distribution:" >> $GITHUB_STEP_SUMMARY
136237 echo "- GitHub Release: ✅" >> $GITHUB_STEP_SUMMARY
0 commit comments