ncc/.gitlab-ci.yml
2023-08-16 15:52:52 -04:00

60 lines
No EOL
1.4 KiB
YAML

image: php:8.2
stages:
- setup
- install
- build
- publish
before_script:
- apt update -yqq
- apt install -yqq git libzip-dev zip make wget libonig-dev libcurl4-openssl-dev
# Prepare the environment
setup:
stage: setup
script:
- docker-php-ext-install mbstring ctype posix zip curl fileinfo
# Install Phive and Phpab
install:
stage: install
script:
- wget -O phive.phar https://phar.io/releases/phive.phar
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
- chmod +x phive.phar
- mv phive.phar /usr/local/bin/phive
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Build the project using the Makefile
build:
stage: build
script:
- make autoload
- make redist
- make tar
artifacts:
paths:
- build/*.tar.gz
# Publish the package
publish:
stage: publish
script:
- |
if [[ ! -z "$CI_COMMIT_TAG" ]]; then
# If this is a tagged commit, use the tag name as package name
PACKAGE_NAME=$CI_COMMIT_TAG
else
# Otherwise, use the branch name as the package name
PACKAGE_NAME=$CI_COMMIT_REF_NAME
fi
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