ncc/.gitlab-ci.yml

59 lines
1.5 KiB
YAML
Raw Normal View History

stages:
- setup
- install
- build
- publish
# Prepare the environment
setup:
stage: setup
image: php:8.2
2023-08-16 12:20:16 -04:00
script:
2023-08-16 14:59:06 -04:00
- apt update -yqq
2023-08-16 15:00:48 -04:00
- apt install git libzip-dev zip make wget gnupg libonig-dev -yqq
2023-08-16 15:07:51 -04:00
- docker-php-ext-install mbstring ctype tokenizer posix zip curl mcrypt fileinfo
2023-03-01 19:08:18 +00:00
# Install Phive and Phpab
install:
stage: install
script:
2023-08-16 12:22:30 -04:00
- wget -O phive.phar https://phar.io/releases/phive.phar
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
- gpg --verify phive.phar.asc phive.phar
- chmod +x phive.phar
- mv phive.phar /usr/local/bin/phive
- phive install phpab --global
2023-08-16 12:22:30 -04:00
# Build the project using the Makefile
build:
stage: build
2023-03-01 19:08:18 +00:00
script:
- make autoload
2023-08-16 12:22:30 -04:00
- make redist
- make tar
2023-08-16 12:20:16 -04:00
artifacts:
paths:
- build/*.tar.gz
2023-08-16 12:20:16 -04:00
# Publish the package
publish:
stage: publish
2023-08-16 12:20:16 -04:00
script:
2023-08-16 12:22:30 -04:00
- |
2023-08-16 15:09:24 -04:00
if [[ ! -z "$CI_COMMIT_TAG" ]]; then
# If this is a tagged commit, use the tag name as package name
PACKAGE_NAME=$CI_COMMIT_TAG
2023-08-16 12:22:30 -04:00
else
2023-08-16 15:09:24 -04:00
# Otherwise, use the branch name as the package name
PACKAGE_NAME=$CI_COMMIT_REF_NAME
2023-08-16 12:22:30 -04:00
fi
2023-08-16 15:09:24 -04:00
echo "Package Name: $PACKAGE_NAME"
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file build/*.tar.gz \
"https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME/$CI_PIPELINE_ID/file.tar.gz"
only:
- branches
- tags