branch first

This commit is contained in:
Marc Beninca 2024-07-20 16:58:26 +02:00
parent 60f1a717c5
commit 88cb222ebe
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

24
spcd.sh
View file

@ -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 "ø"