Skip to content

Commit 2d35b45

Browse files
committed
fixup! fixup! fixup! fixup! fix(ci): chain build-phar workflow from release-please
1 parent 395e38c commit 2d35b45

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/build-phar.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
steps:
3030
- name: Checkout code
3131
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ inputs.tag_name || github.ref }}
34+
fetch-tags: true
3235

3336
- name: Setup PHP
3437
uses: shivammathur/setup-php@v2
@@ -54,6 +57,8 @@ jobs:
5457

5558
- name: Build PHAR
5659
run: php build.php
60+
env:
61+
BUILD_VERSION: ${{ inputs.tag_name }}
5762

5863
- name: Test PHAR
5964
run: |

build.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
$buildDir = __DIR__ . '/build';
2828
$pharFile = $buildDir . '/oce-import-codes.phar';
2929

30-
echo "Building oce-import-codes.phar...\n";
30+
// Determine version: BUILD_VERSION env var > git describe > fallback
31+
$version = getenv('BUILD_VERSION') ?: null;
32+
if (!$version) {
33+
$version = trim((string) shell_exec('git describe --tags 2>/dev/null')) ?: 'dev';
34+
}
35+
36+
echo "Building oce-import-codes.phar (version: $version)...\n";
3137

3238
// Create build directory
3339
if (!is_dir($buildDir)) {
@@ -45,7 +51,7 @@
4551
// Set metadata
4652
$phar->setMetadata([
4753
'name' => 'oce-import-codes',
48-
'version' => '1.0.0',
54+
'version' => $version,
4955
'created' => date('Y-m-d H:i:s')
5056
]);
5157

0 commit comments

Comments
 (0)