diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f86e493a..69910a434 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,4 +65,22 @@ jobs: composer install composer global require phpstan/phpstan ~/.composer/vendor/bin/phpstan analyse + libver-check: + runs-on: ubuntu-latest + name: Verify Google\Client::LIBVER + steps: + + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + - name: Verify libver + run: | + LIBVER=$(php -r 'require "src/Client.php"; echo Google\Client::LIBVER;') + RELEASEVER=$(php -r 'preg_match("/## \[(\d.\d+.\d+)\]\(/", file_get_contents("CHANGELOG.md"), $matches);echo $matches[1];') + if [ "$LIBVER" != "$RELEASEVER" ]; then + echo "Google\Client::LIBVER ($LIBVER) does not equal the current release ($RELEASEVER)." + exit 1 + fi diff --git a/src/Client.php b/src/Client.php index edfb1f83e..cd220cbd4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -52,7 +52,11 @@ */ class Client { - const LIBVER = "2.12.6"; + // Release Please updates the VERSION constant. This workaround ensures the LIBVER constant + // will be updated for each release as well. + private const VERSION = '2.18.3'; + const LIBVER = self::VERSION; + const USER_AGENT_SUFFIX = "google-api-php-client/"; const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke'; const OAUTH2_TOKEN_URI = 'https://oauth2.googleapis.com/token'; @@ -64,7 +68,7 @@ class Client */ private $auth; - /** + ** * @var ClientInterface $http */ private $http;