File tree Expand file tree Collapse file tree 2 files changed +29
-12
lines changed Expand file tree Collapse file tree 2 files changed +29
-12
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,38 @@ name: Set up PostgreSQL on Windows
33runs :
44 using : composite
55 steps :
6+ - name : Decide Postgis version (Windows)
7+ # Borrowed from https://github.com/nyurik/action-setup-postgis/blob/main/action.yml
8+ id : postgis-ver
9+ shell : pwsh
10+ run : |
11+ echo "PowerShell version: ${PSVersionTable.PSVersion}"
12+ $PG_VERSION = Split-Path $env:PGROOT -Leaf
13+ $postgis_page = "https://download.osgeo.org/postgis/windows/pg$PG_VERSION"
14+ echo "Detecting PostGIS version from $postgis_page for PostgreSQL $PG_VERSION"
15+ $pgis_bundle = (Invoke-WebRequest -Uri $postgis_page -ErrorAction Stop).Links.Where({$_.href -match "^postgis.*zip$"}).href
16+ if (!$pgis_bundle) {
17+ Write-Error "Could not find latest PostGIS version in $postgis_page that would match ^postgis.*zip$ pattern"
18+ exit 1
19+ }
20+ $pgis_bundle = [IO.Path]::ChangeExtension($pgis_bundle, [NullString]::Value)
21+ $pgis_bundle_url = "$postgis_page/$pgis_bundle.zip"
22+ Add-Content $env:GITHUB_OUTPUT "postgis_file=$pgis_bundle"
23+ Add-Content $env:GITHUB_OUTPUT "postgis_bundle_url=$pgis_bundle_url"
24+
25+ - uses : actions/cache@v4
26+ with :
27+ path : |
28+ C:/postgis.zip
29+ key : postgis-cache-${{ steps.postgis-ver.outputs.postgis_file }}
30+
631 - name : Download postgis
732 run : |
8- if (!(Test-Path "C:\postgis.zip")){(new-object net.webclient).DownloadFile("https://osm2pgsql.org/ci/winbuild/postgis-bundle-pg14-3.2.0x64.zip" , "c:\postgis.zip")}
33+ if (!(Test-Path "C:\postgis.zip")){(new-object net.webclient).DownloadFile($env:PGIS_BUNDLE_URL , "c:\postgis.zip")}
934 7z x c:\postgis.zip -oc:\postgis_archive
1035 shell : pwsh
36+ env :
37+ PGIS_BUNDLE_URL : ${{ steps.postgis-ver.outputs.postgis_bundle_url }}
1138
1239 - name : Install postgis
1340 run : |
Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ jobs:
341341 strategy :
342342 fail-fast : false
343343 matrix :
344- os : [windows-2019, windows-2022]
344+ os : [windows-2019, windows-2022, windows-2025 ]
345345 runs-on : ${{ matrix.os }}
346346
347347 env :
@@ -356,11 +356,6 @@ jobs:
356356 key : vcpkg-binary-cache-${{ matrix.os }}-${{ github.run_id }}
357357 restore-keys : |
358358 vcpkg-binary-cache-${{ matrix.os }}
359- - uses : actions/cache@v4
360- with :
361- path : |
362- C:/postgis.zip
363- key : postgis-cache
364359 - name : Prepare cache
365360 run : if [ ! -d C:/vcpkg_binary_cache ]; then mkdir C:/vcpkg_binary_cache; fi
366361 shell : bash
@@ -393,11 +388,6 @@ jobs:
393388
394389 steps :
395390 - uses : actions/checkout@v4
396- - uses : actions/cache@v4
397- with :
398- path : |
399- C:/postgis.zip
400- key : postgis-cache
401391 - uses : actions/download-artifact@v4
402392 with :
403393 name : osm2pgsql-win64
You can’t perform that action at this time.
0 commit comments