ncc/.gitlab-ci.yml

57 lines
1.4 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 14:59:06 -04:00
- docker-php-ext-install mbstring ctype tokenizer posix zip
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
- |
if [[ "$CI_COMMIT_REF_NAME" == "master" || "$CI_COMMIT_REF_NAME" == "dev" ]]; then
PACKAGE_NAME=$CI_COMMIT_REF_NAME
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
PACKAGE_NAME=$CI_COMMIT_TAG
2023-08-16 12:22:30 -04:00
else
PACKAGE_NAME=feature/$CI_COMMIT_REF_NAME
2023-08-16 12:22:30 -04:00
fi
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