diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ade84792a..453e88148 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 33147925f..c859fe6e6 100644 --- a/src/Client.php +++ b/src/Client.php @@ -53,7 +53,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.19.1'; + 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';