[PECL-CVS] [pecl-datetime-timezonedb] master: Overhaul Github Actions to build releases correctly

[email protected] (Derick Rethans) Thu, 8 Jan 2026 13:41:11 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Derick Rethans (derickr)
Date: 2026-01-08T14:41:09+01:00

Commit: https://github.com/php/pecl-datetime-timezonedb/commit/472cf5f1012d7020ea8fb88bbe2513d810cfaec4
Raw diff: https://github.com/php/pecl-datetime-timezonedb/commit/472cf5f1012d7020ea8fb88bbe2513d810cfaec4.diff

Overhaul Github Actions to build releases correctly

Changed paths:
  M  .github/workflows/build.yml


Diff:

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d24df04..eb62cc8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,89 +9,71 @@ on:
     create:
 
 jobs:
+    get-extension-matrix:
+        runs-on: ubuntu-latest
+        name: "Windows Build Matrix"
+        outputs:
+            matrix: ${{ steps.extension-matrix.outputs.matrix }}
+        steps:
+            - name: Checkout
+              uses: actions/checkout@v5
+            - name: Get The Extension Matrix
+              id: extension-matrix
+              uses: php/php-windows-builder/extension-matrix@v1
+
     windows:
-        runs-on: windows-latest
-        name: "Windows: Build and test"
-        defaults:
-            run:
-                shell: cmd
+        needs: get-extension-matrix
+        runs-on: ${{ matrix.os }}
+        name: "Windows"
         strategy:
             fail-fast: false
-            matrix:
-                php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
-                arch: [x86, x64]
-                ts: [nts, ts]
-                experimental: [false]
+            matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
         steps:
-                - name: Checkout Repository
-                  uses: actions/checkout@v3
-                - name: Extract Version
-                  shell: powershell
-                  run: |
-                    chcp 65001
-                    $r = Select-String -Path php_timezonedb.h -Pattern 'PHP_TIMEZONEDB_VERSION\s+"(.*)"'
-                    $s = $r.Matches[0].Groups[1]
-                    echo "$s"
-                    $extension_version = 'EXTENSION_VERSION=' + $s
-                    echo $extension_version >> $env:GITHUB_ENV
-                - name: Setup PHP
-                  id: setup-php
-                  uses: php/[email protected]
-                  with:
-                      version: ${{matrix.php}}
-                      arch: ${{matrix.arch}}
-                      ts: ${{matrix.ts}}
-                - name: Enable Developer Command Prompt
-                  uses: ilammy/msvc-dev-cmd@v1
-                  with:
-                      arch: ${{matrix.arch}}
-                      toolset: ${{steps.setup-php.outputs.toolset}}
-                - name: Generate Build Files
-                  run: phpize
-                - name: Configure Build
-                  run: configure --enable-timezonedb --with-prefix=${{steps.setup-php.outputs.prefix}}
-                - name: Build
-                  run: nmake
-                - name: Define Module Env
-                  shell: powershell
-                  run: |
-                    chcp 65001
+            - name: Checkout
+              uses: actions/checkout@v5
 
-                    $dir = (Get-Location).Path + '\'
-                    if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' }
-                    $dir = $dir + 'Release'
-                    if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' }
+            - name: Build The Extension
+              uses: php/php-windows-builder/extension@v1
+              with:
+                php-version: ${{ matrix.php-version }}
+                arch: ${{ matrix.arch }}
+                ts: ${{ matrix.ts }}
+                args: --enable-timezonedb
 
-                    $artifact_name = 'php_timezonedb-${{env.EXTENSION_VERSION}}-${{matrix.php}}'
-
-                    if ('7.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
-                    if ('7.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
-                    if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
-                    if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
-                    if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
-                    if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
-
-                    if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' }
-                    if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' }
+    linux:
+        runs-on: ubuntu-latest
+        name: "Linux"
+        strategy:
+            fail-fast: false
+            matrix:
+                php: [8.0, 8.1, 8.2, 8.3, 8.4, 8.5]
+                experimental: [false]
+        steps:
+            -   uses: actions/checkout@v4
 
-                    $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name
-                    echo $extension_artifact_name >> $env:GITHUB_ENV
+            -   name: Setup PHP
+                uses: shivammathur/setup-php@v2
+                with:
+                    php-version: "${{ matrix.php }}"
+                    coverage: none
+                    ini-values: "session.save_path=/tmp"
+                    tools: pecl
 
-                    $from = $dir + '\php_timezonedb.dll'
-                    $to = $dir + '\' + $artifact_name + ".dll"
-                    Copy-Item $from -Destination $to
-                    $extension_artifact = "ARTIFACT=" + $to
-                    echo $extension_artifact >> $env:GITHUB_ENV
+            -   name: Compile
+                run: phpize && ./configure && make all
 
-                - name: Upload artifacts
-                  uses: actions/upload-artifact@v3
-                  with:
-                      name: ${{env.ARTIFACT_NAME}}
-                      path: ${{env.ARTIFACT}}
+            -   name: Run tests
+                continue-on-error: ${{ matrix.experimental }}
+                run: make test
 
-                - name: Publish Binaries to Release
-                  if: ${{ startsWith(github.ref, 'refs/tags') }}
-                  uses: svenstaro/upload-release-action@v2
-                  with:
-                      asset_name: ${{env.ARTIFACT_NAME}}.dll
-                      file: ${{env.ARTIFACT}}
+    release:
+        runs-on: ubuntu-latest
+        name: "PIE Release Artifacts"
+        needs: windows
+        if: ${{ github.event_name == 'release' }}
+        steps:
+            - name: Upload artifact to the release
+              uses: php/php-windows-builder/release@v1
+              with:
+                release: ${{ github.event.release.tag_name }}
+                token: ${{ secrets.GITHUB_TOKEN }}