-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use GITHUB_ENV for setting environment variable COMPOSER_ROOT_VERSION
copying approach from laminas/laminas-cache-storage-adapter-blackhole Signed-off-by: Dennis Riehle <webmaster@riehle-web.com>
- Loading branch information
Showing
4 changed files
with
37 additions
and
13 deletions.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash -l | ||
|
||
if [[ -z "${GITHUB_BASE_REF}" ]]; then | ||
echo "Environment variable \"GITHUB_BASE_REF\" does not exist." | ||
|
||
exit 0 | ||
fi | ||
|
||
BRANCH_REGEX="[0-9]+\.[0-9]+\.x" | ||
|
||
if ! [[ "${GITHUB_BASE_REF}" =~ ${BRANCH_REGEX} ]]; then | ||
echo "Environment variable \"GITHUB_BASE_REF\" does not match expectations." | ||
echo "Must match ${BRANCH_REGEX}"; | ||
|
||
exit 0 | ||
fi | ||
|
||
export COMPOSER_ROOT_VERSION=$(echo ${GITHUB_BASE_REF} | sed 's/\.x/\.99/g') | ||
|
||
echo "Determined composer root version as \"${COMPOSER_ROOT_VERSION}\"." | ||
|
||
if [[ true = "${GITHUB_ACTIONS}" ]]; then | ||
echo "Setting COMPOSER_ROOT_VERSION environment variable to \"${COMPOSER_ROOT_VERSION}\"." | ||
if [ ! -w "${GITHUB_ENV}" ]; then | ||
echo "Missing GITHUB_ENV environment variable. Cannot store COMPOSER_ROOT_VERSION to be available within the current check." | ||
exit 1 | ||
fi | ||
echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> "${GITHUB_ENV}" | ||
fi | ||
|
||
return |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.