-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Geneate PHP part version from composer post install hook (#94)
* Geneate PHP part version from composer post install hook * Added missing version file to php deps
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,5 @@ jobs: | |
name: php-dependencies | ||
path: | | ||
prod/php/vendor_* | ||
prod/php/ElasticOTel/PhpPartVersion.php | ||
NOTICE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#generated version file | ||
prod/php/ElasticOTel/PhpPartVersion.php | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* this file is generated, do not edit it manually */ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Elastic\OTel; | ||
|
||
const ELASTIC_OTEL_PHP_VERSION = '__ELASTIC_OTEL_PHP_VERSION__'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
source ./tools/read_properties.sh | ||
|
||
read_properties elastic-otel-php.properties ELASTIC_OTEL_PHP | ||
|
||
get_git_hash() { | ||
if [ -z "${GITHUB_SHA}" ]; then | ||
IS_DIRTY=false | ||
|
||
git diff-index --quiet HEAD -- | ||
GIT_RESULT=$? | ||
|
||
if [ $GIT_RESULT -ne 0 ]; then | ||
IS_DIRTY=true | ||
fi | ||
|
||
GIT_VERSION=$(git rev-parse --short HEAD 2>/dev/null) | ||
GIT_RESULT=$? | ||
|
||
if [ $GIT_RESULT -ne 0 ]; then | ||
TMP_OUTPUT_HASH="" | ||
else | ||
if [ "$IS_DIRTY" = true ]; then | ||
TMP_OUTPUT_HASH="~${GIT_VERSION}-dirty" | ||
else | ||
TMP_OUTPUT_HASH="~${GIT_VERSION}" | ||
fi | ||
fi | ||
|
||
echo "$TMP_OUTPUT_HASH" | ||
fi | ||
} | ||
|
||
ELASTIC_OTEL_PHP_VERSION="${ELASTIC_OTEL_PHP_VERSION}$(get_git_hash)" | ||
|
||
sed "s/__ELASTIC_OTEL_PHP_VERSION__/$ELASTIC_OTEL_PHP_VERSION/g" prod/php/ElasticOTel/PhpPartVersion.php.template > prod/php/ElasticOTel/PhpPartVersion.php | ||
|
||
echo "The file prod/php/ElasticOTel/PhpPartVersion.php has been generated with version ${ELASTIC_OTEL_PHP_VERSION}" |