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" spcd_step "Set environment variables"
# continuous integration / github → gitea → forgejo # continuous integration / github → gitea → forgejo
if [ -n "${GITHUB_ACTIONS}" ]; then 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 # project root
if [ -n "${GITHUB_SERVER_URL}" ]; then if [ -n "${GITHUB_SERVER_URL}" ]; then
SPCD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" SPCD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//"
@ -74,14 +80,14 @@ spcd_set_environment_variables() {
else else
spcd_error_ci "GITHUB_REPOSITORY" spcd_error_ci "GITHUB_REPOSITORY"
fi 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 # continuous integration / gitlab
elif [ -n "${GITLAB_CI}" ]; then 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 # project root / protocol
if [ -n "${CI_SERVER_PROTOCOL}" ]; then if [ -n "${CI_SERVER_PROTOCOL}" ]; then
# project root / login # project root / login
@ -117,12 +123,6 @@ spcd_set_environment_variables() {
else else
spcd_error_ci "CI_SERVER_PROTOCOL" spcd_error_ci "CI_SERVER_PROTOCOL"
fi 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 # continuous integration / unsupported
else else
spcd_error_ci "ø" spcd_error_ci "ø"