diff --git a/spcd.sh b/spcd.sh index b5ed78b..9a2719e 100644 --- a/spcd.sh +++ b/spcd.sh @@ -56,6 +56,12 @@ spcd_set_environment_variables() { spcd_step "Set environment variables" # continuous integration / github → gitea → forgejo if [ -n "${GITHUB_ACTIONS}" ]; then + # project branch + if [ -n "${GITHUB_REF_NAME}" ]; then + SPCD_PROJECT_BRANCH="${GITHUB_REF_NAME}" + else + spcd_error_ci "GITHUB_REF_NAME" + fi # project root if [ -n "${GITHUB_SERVER_URL}" ]; then SPCD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" @@ -74,14 +80,14 @@ spcd_set_environment_variables() { else spcd_error_ci "GITHUB_REPOSITORY" fi - # project branch - if [ -n "${GITHUB_REF_NAME}" ]; then - SPCD_PROJECT_BRANCH="${GITHUB_REF_NAME}" - else - spcd_error_ci "GITHUB_REF_NAME" - fi # continuous integration / gitlab elif [ -n "${GITLAB_CI}" ]; then + # project branch + if [ -n "${CI_COMMIT_BRANCH}" ]; then + SPCD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" + else + spcd_error_ci "CI_COMMIT_BRANCH" + fi # project root / protocol if [ -n "${CI_SERVER_PROTOCOL}" ]; then # project root / login @@ -117,12 +123,6 @@ spcd_set_environment_variables() { else spcd_error_ci "CI_SERVER_PROTOCOL" fi - # project branch - if [ -n "${CI_COMMIT_BRANCH}" ]; then - SPCD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" - else - spcd_error_ci "CI_COMMIT_BRANCH" - fi # continuous integration / unsupported else spcd_error_ci "ø"