Skip to content

Commit 2a9bf9a

Browse files
committed
Use package version from phongo_version.h for install
1 parent 0df9e50 commit 2a9bf9a

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/build-package-files.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ jobs:
4242
- name: "Build release archive"
4343
run: "make package"
4444

45+
- name: "Read current package version"
46+
run: echo "PACKAGE_VERSION=$(./bin/update-release-version.php version)" >> "$GITHUB_ENV"
47+
4548
- name: "Install release archive to verify correctness"
46-
run: pecl install mongodb-${{ github.ref_name }}.tgz
49+
run: pecl install mongodb-${{ env.PACKAGE_VERSION }}.tgz
4750

4851
- name: "Upload archive"
4952
uses: actions/upload-artifact@v4
5053
with:
51-
name: mongodb-${{ github.ref_name }}.tgz
52-
path: mongodb-${{ github.ref_name }}.tgz
54+
name: mongodb-${{ env.PACKAGE_VERSION }}.tgz
55+
path: mongodb-${{ env.PACKAGE_VERSION }}.tgz
5356
retention-days: 3

bin/update-release-version.php

100644100755
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ function usage()
1212
{$argv[0]} <command>
1313
1414
Commands:
15-
stable: Mark the current version as stable
16-
patch: Update to the next patch development version
17-
minor: Update to the next minor development version
15+
stable: Mark the current version as stable
16+
patch: Update to the next patch development version
17+
minor: Update to the next minor development version
18+
version: Print the current version number
1819
1920
EOT;
2021

@@ -31,7 +32,6 @@ function read_release_version(string $filename): array
3132

3233
$versions = [];
3334

34-
// TODO: Error handling
3535
if (! preg_match('/^#define PHP_MONGODB_VERSION "(.*)"$/m', $contents, $matches)) {
3636
throw new Exception('Could not match PHP_MONGODB_VERSION');
3737
}
@@ -147,6 +147,10 @@ function get_next_minor_version(array $versions): array
147147
$currentVersion = read_release_version(VERSION_FILENAME);
148148

149149
switch ($argv[1] ?? null) {
150+
case 'version':
151+
echo $currentVersion['version'];
152+
exit(0);
153+
150154
case 'stable':
151155
$newVersion = get_stable_version($currentVersion);
152156
break;

0 commit comments

Comments
 (0)