From 6267cfd58ad0dbd3f281274eba17435872317f08 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Oct 2019 21:55:44 +1100 Subject: [PATCH] update to use both set-env and set-output --- docker-toughday | 2 +- scripts/github/github_container_verify.sh | 1 + scripts/github/github_get_config.sh | 5 +++++ scripts/github/github_get_version.sh | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docker-toughday b/docker-toughday index a88dc78..65c0718 160000 --- a/docker-toughday +++ b/docker-toughday @@ -1 +1 @@ -Subproject commit a88dc7886583556bf916da29e7c07dd55b0f61fd +Subproject commit 65c07189348451d46c6b9e0be28cbcf331452446 diff --git a/scripts/github/github_container_verify.sh b/scripts/github/github_container_verify.sh index a91eb73..813564c 100755 --- a/scripts/github/github_container_verify.sh +++ b/scripts/github/github_container_verify.sh @@ -18,6 +18,7 @@ echo "TEST_COMMAND:${TEST_COMMAND}" echo "TEST:docker run --env TEST_COMMAND ${IMAGE}:${IMAGE_VERSION} bash -c 'echo \$(\${TEST_COMMAND} 2>&1) | grep -q -e ${TEST_COMMAND_VERIFY} && echo true || echo false'" export CONTAINER_OUTPUT=$(docker run --env TEST_COMMAND ${IMAGE}:${IMAGE_VERSION} bash -c "echo \$(\${TEST_COMMAND} 2>&1) | grep -q -e \"${TEST_COMMAND_VERIFY}\" && echo true || echo false") echo ::set-env name=CONTAINER_OUTPUT::$CONTAINER_OUTPUT +echo ::set-output name=CONTAINER_OUTPUT::$CONTAINER_OUTPUT echo "CONTAINER_OUTPUT:${CONTAINER_OUTPUT}" echo "TEST IF OUTPUT MATCHES EXPECTED" if [[ "${CONTAINER_OUTPUT}" == "false" ]]; then diff --git a/scripts/github/github_get_config.sh b/scripts/github/github_get_config.sh index 62c17e9..047bff9 100755 --- a/scripts/github/github_get_config.sh +++ b/scripts/github/github_get_config.sh @@ -9,14 +9,19 @@ fi echo ">>> GET CONFIG FROM DOCKERFILE <<<" export IMAGE_NAME=$(grep imagename= Dockerfile | sed -e 's/.*imagename="\(.*\)".*/\1/') echo ::set-env name=IMAGE_NAME::${IMAGE_NAME} +echo ::set-output name=IMAGE_NAME::${IMAGE_NAME} export TEST_COMMAND=$(grep test.command= Dockerfile | sed -e 's/.*test.command="\(.*\)".*/\1/') echo ::set-env name=TEST_COMMAND::${TEST_COMMAND} +echo ::set-output name=TEST_COMMAND::${TEST_COMMAND} export TEST_COMMAND_VERIFY=$(grep test.command.verify= Dockerfile | sed -e 's/.*test.command.verify="\(.*\)".*/\1/') echo ::set-env name=TEST_COMMAND_VERIFY::${TEST_COMMAND_VERIFY} +echo ::set-output name=TEST_COMMAND_VERIFY::${TEST_COMMAND_VERIFY} export IMAGE_VERSION=$(grep version= Dockerfile | sed -e 's/.*version="\(.*\)".*/\1/') echo ::set-env name=IMAGE_VERSION::${IMAGE_VERSION} +echo ::set-output name=IMAGE_VERSION::${IMAGE_VERSION} export IMAGE="${ORGANISATION_NAME}/${IMAGE_NAME}" echo ::set-env name=IMAGE::${IMAGE} +echo ::set-output name=IMAGE::${IMAGE} echo "IMAGE_NAME=${IMAGE_NAME}" echo "IMAGE_VERSION=${IMAGE_VERSION}" echo "TEST_COMMAND=${TEST_COMMAND}" diff --git a/scripts/github/github_get_version.sh b/scripts/github/github_get_version.sh index 82cd5b9..8598839 100755 --- a/scripts/github/github_get_version.sh +++ b/scripts/github/github_get_version.sh @@ -13,18 +13,23 @@ echo "CURRENT_VERSION:${CURRENT_VERSION}" declare -a CURRENT_VERSION_ARRAY="(${CURRENT_VERSION//./ })"; export SEMVER_MAJOR=${CURRENT_VERSION_ARRAY[0]}; echo ::set-env name=SEMVER_MAJOR::${SEMVER_MAJOR} +echo ::set-output name=SEMVER_MAJOR::${SEMVER_MAJOR} export SEMVER_MINOR=${CURRENT_VERSION_ARRAY[1]}; echo ::set-env name=SEMVER_MINOR::${SEMVER_MINOR} +echo ::set-output name=SEMVER_MINOR::${SEMVER_MINOR} export SEMVER_PATCH=${CURRENT_VERSION_ARRAY[2]}; echo ::set-env name=SEMVER_PATCH::${SEMVER_PATCH} +echo ::set-output name=SEMVER_PATCH::${SEMVER_PATCH} export SEMVER_BUILD=${CURRENT_VERSION_ARRAY[-1]} echo ::set-env name=SEMVER_BUILD::${SEMVER_BUILD} +echo ::set-output name=SEMVER_BUILD::${SEMVER_BUILD} # if tag already has MAJOR.MINOR.PATCH add git log commit count to patch if [[ "${#CURRENT_VERSION_ARRAY[@]}" == "4" ]]; then echo "ADD PATCH TO BUILD VERSION" export SEMVER_BUILD=$(( ${SEMVER_PATCH} + ${SEMVER_BUILD} )) echo ::set-env name=SEMVER_BUILD::${SEMVER_BUILD} + echo ::set-output name=SEMVER_BUILD::${SEMVER_BUILD} fi echo "SEMVER_MAJOR:${SEMVER_MAJOR}" @@ -39,6 +44,7 @@ fi export SEMVER=${SEMVER_MAJOR}.${SEMVER_MINOR}.${SEMVER_BUILD} echo ::set-env name=SEMVER::${SEMVER} +echo ::set-output name=SEMVER::${SEMVER} echo "SEMVER:${SEMVER}" if [[ ${SEMVER_MAJOR} == "" ]];then echo PLEASE ADD TAG TO YOUR BRANCH @@ -46,6 +52,8 @@ if [[ ${SEMVER_MAJOR} == "" ]];then fi export GITHUB_TAG=${SEMVER} echo ::set-env name=GITHUB_TAG::${GITHUB_TAG} +echo ::set-output name=GITHUB_TAG::${GITHUB_TAG} echo "GITHUB_TAG:${GITHUB_TAG}" export GIT_RELEASE_NOTES="$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h - %s (%an)")" echo ::set-env name=GIT_RELEASE_NOTES::${GIT_RELEASE_NOTES} +echo ::set-output name=GIT_RELEASE_NOTES::${GIT_RELEASE_NOTES}