Skip to content

Commit 0662056

Browse files
authored
fix: update libver and add release test (#2672)
1 parent 5f6a31e commit 0662056

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,22 @@ jobs:
6565
composer install
6666
composer global require phpstan/phpstan
6767
~/.composer/vendor/bin/phpstan analyse
68+
libver-check:
69+
runs-on: ubuntu-latest
70+
name: Verify Google\Client::LIBVER
71+
steps:
72+
73+
- uses: actions/checkout@v2
74+
- name: Setup PHP
75+
uses: shivammathur/setup-php@v2
76+
with:
77+
php-version: '8.1'
78+
- name: Verify libver
79+
run: |
80+
LIBVER=$(php -r 'require "src/Client.php"; echo Google\Client::LIBVER;')
81+
RELEASEVER=$(php -r 'preg_match("/## \[(\d.\d+.\d+)\]\(/", file_get_contents("CHANGELOG.md"), $matches);echo $matches[1];')
82+
if [ "$LIBVER" != "$RELEASEVER" ]; then
83+
echo "Google\Client::LIBVER ($LIBVER) does not equal the current release ($RELEASEVER)."
84+
exit 1
85+
fi
6886

src/Client.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353
*/
5454
class Client
5555
{
56-
const LIBVER = "2.12.6";
56+
// Release Please updates the VERSION constant. This workaround ensures the LIBVER constant
57+
// will be updated for each release as well.
58+
private const VERSION = '2.19.1';
59+
const LIBVER = self::VERSION;
60+
5761
const USER_AGENT_SUFFIX = "google-api-php-client/";
5862
const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
5963
const OAUTH2_TOKEN_URI = 'https://oauth2.googleapis.com/token';

0 commit comments

Comments
 (0)